uselotus / lotus

File .deepsource.toml not found in the default branch of the repository root. Please refer to the docs.

Bad comparison test PTC-W0023
Anti-pattern
Minor
a year agoa year old
Use is when comparing type of two objects
 304            serializer.validated_data.get(key, None)
 305            for key in ["start_date", "end_date", "top_n_customers"]
 306        ]
 307        if type(q_start) == str: 308            q_start = parser.parse(q_start).date()
 309        if type(q_end) == str:
 310            q_end = parser.parse(q_end).date()
Use is when comparing type of two objects
 306        ]
 307        if type(q_start) == str:
 308            q_start = parser.parse(q_start).date()
 309        if type(q_end) == str: 310            q_end = parser.parse(q_end).date()
 311        q_start = date_as_min_dt(q_start)
 312        q_end = date_as_max_dt(q_end)
Use is when comparing type of two objects
 641        pc = PlanComponent.objects.create(**validated_data)
 642        for tier in tiers:
 643            tier = PriceTierSerializer().create(tier)
 644            assert type(tier) == PriceTier 645            tier.plan_component = pc
 646            tier.save()
 647        return pc
Use is when comparing type of two objects
 872        components_data = validated_data.pop("plan_components", [])
 873        if len(components_data) > 0:
 874            components = PlanComponentSerializer(many=True).create(components_data)
 875            assert type(components[0]) == PlanComponent 876        else:
 877            components = []
 878        features_data = validated_data.pop("features", [])
Use is when comparing type of two objects
111        ]
112        for k, v in flat_costs_dict_list:
113            last_elem_amount, last_elem_plan, last_elem_start, _ = date_range_costs[-1]
114            assert type(k) == type(str(issue_date.date())), "k is not a string"115            if (str(issue_date.date()) < k) and flat_fee_behavior == "prorate":
116                # only add flat fee if it is before or equal the issue date, or if we specified
117                # that we are NOT prorating