Exemple #1
0
 def test_fuzzy_operation_compare(self):
     self.assertTrue(
         self.lookup.test_operation_equal(
             test_operation_dict,
             test_operation_equal_search=[
                 comparators.cmp_required_keys(
                     ["description", "event_id", "rules_id"]),
                 comparators.cmp_status(),
                 comparators.cmp_event(),
                 comparators.cmp_all_description()
             ]))
     t2 = deepcopy(test_operation_dict)
     t2["description"] = [
         ["en", "Handicap (0:1)"],
     ]
     self.assertFalse(
         self.lookup.test_operation_equal(
             t2,
             test_operation_equal_search=[
                 comparators.cmp_all_description()
             ]))
     self.assertTrue(
         self.lookup.test_operation_equal(
             t2,
             test_operation_equal_search=[
                 comparators.cmp_description("en")
             ]))
    def test_fuzzy_operation_compare(self):
        self.assertTrue(
            self.lookup.test_operation_equal(
                test_operation_dict,
                test_operation_equal_search=[
                    comparators.cmp_required_keys(
                        ["description", "event_id", "rules_id"]),
                    comparators.cmp_status(),
                    comparators.cmp_event(),
                    comparators.cmp_all_description(),
                ],
            ))
        t2 = deepcopy(test_operation_dict)
        t2["description"] = [
            ["display_name", "Over/Under 3.5 pts"],
            ["en", "Over/Under 3.5 pts"],
            ["sen", "Total Points"],
            ["_dynamic", "FAKE"],
            ["_ou", "FAKE"],
        ]
        self.assertFalse(
            self.lookup.test_operation_equal(
                t2,
                test_operation_equal_search=[
                    comparators.cmp_all_description()
                ]))
        self.assertTrue(
            self.lookup.test_operation_equal(
                t2,
                test_operation_equal_search=[
                    comparators.cmp_descriptions(["en", "display_name"])
                ],
            ))

        self.assertTrue(
            self.lookup.test_operation_equal(
                t2,
                test_operation_equal_search=[
                    comparators.cmp_langs("description",
                                          langs=lambda x: x[0] != "_")
                ],
            ))