def test_equivalence(self): partitioner = EquivalencePartitioner.make_propertystate_equivalence() p1 = PropertyState(pm_property_id=100) p2 = PropertyState(pm_property_id=100) p3 = PropertyState(pm_property_id=200) p4 = PropertyState(custom_id_1=100) p5 = PropertyState(ubid='abc+123') p6 = PropertyState(ubid='100') p7 = PropertyState(ubid='abc+123') equivalence_classes = partitioner.calculate_equivalence_classes( [p1, p2]) self.assertEqual(len(equivalence_classes), 1) equivalence_classes = partitioner.calculate_equivalence_classes( [p1, p3]) self.assertEqual(len(equivalence_classes), 2) equivalence_classes = partitioner.calculate_equivalence_classes( [p1, p4]) self.assertEqual(len(equivalence_classes), 1) equivalence_classes = partitioner.calculate_equivalence_classes( [p4, p6]) self.assertEqual(len(equivalence_classes), 2) equivalence_classes = partitioner.calculate_equivalence_classes( [p5, p6]) self.assertEqual(len(equivalence_classes), 2) equivalence_classes = partitioner.calculate_equivalence_classes( [p5, p7]) self.assertEqual(len(equivalence_classes), 1)
def test_equivalence(self): all_unmatched_properties = self.import_file.find_unmatched_property_states( ) unmatched_properties, duplicate_property_states = tasks.filter_duplicated_states( all_unmatched_properties) partitioner = EquivalencePartitioner.make_propertystate_equivalence() equiv_classes = partitioner.calculate_equivalence_classes( unmatched_properties) self.assertEqual(len(equiv_classes), 512)
def test_equivalence(self): all_unmatched_properties = self.import_file.find_unmatched_property_states( ) unmatched_property_ids, duplicate_property_count = match.filter_duplicate_states( all_unmatched_properties) partitioner = EquivalencePartitioner.make_propertystate_equivalence() unmatched_properties = list( PropertyState.objects.filter(pk__in=unmatched_property_ids)) equiv_classes = partitioner.calculate_equivalence_classes( unmatched_properties) self.assertEqual(len(equiv_classes), 512)