def test_other_string_comparisons(self): apple = FuzzyString("Apple") assert apple > "animal" assert "animal" < apple assert not apple < "animal" assert not "animal" > apple assert apple >= "animal" assert apple >= "apple" assert "animal" <= apple assert "animal" <= "animal" assert not apple <= "animal" assert not "animal" >= apple # Additional test between the FuzzyString objects warsaw = FuzzyString("Warsaw") wroclaw = FuzzyString("wroclaw") assert warsaw < wroclaw assert wroclaw > warsaw assert not warsaw > wroclaw assert not wroclaw < warsaw assert warsaw <= wroclaw assert warsaw <= warsaw assert wroclaw >= warsaw assert wroclaw >= wroclaw assert not warsaw >= wroclaw assert not wroclaw <= warsaw
def test_other_string_comparisons(self): apple = FuzzyString("Apple") self.assertGreater(apple, "animal") self.assertLess("animal", apple) self.assertFalse(apple < "animal") self.assertFalse("animal" > apple) self.assertGreaterEqual(apple, "animal") self.assertGreaterEqual(apple, "apple") self.assertLessEqual("animal", apple) self.assertLessEqual("animal", "animal") self.assertFalse(apple <= "animal") self.assertFalse("animal" >= apple) # Additional test between the FuzzyString objects tashkent = FuzzyString("Tashkent") taipei = FuzzyString("taipei") self.assertGreater(tashkent, taipei) self.assertLess(taipei, tashkent) self.assertFalse(tashkent < taipei) self.assertFalse(taipei > tashkent) self.assertGreaterEqual(tashkent, taipei) self.assertGreaterEqual(tashkent, tashkent) self.assertLessEqual(taipei, tashkent) self.assertLessEqual(taipei, taipei) self.assertFalse(tashkent <= taipei) self.assertFalse(taipei >= tashkent)
def test_normalizes_strings(self): string = FuzzyString("\u00df and ss") self.assertEqual(string, "ss and \u00df") string = FuzzyString("ß, ss, \uf9fb, and \u7099") self.assertEqual(string, "ss, ß, \u7099, and \uf9fb") accent = '\u0301' accented_e = FuzzyString('\u00e9') self.assertEqual('\u0065\u0301', accented_e) self.assertIn(accent, accented_e)
def test_normalizes_strings(self): string = FuzzyString("\u00df and ss") assert string == "ss and \u00df" string = FuzzyString("ß, ss, \uf9fb, and \u7099") assert string == "ss, ß, \u7099, and \uf9fb" accent = '\u0301' accented_e = FuzzyString('\u00e9') assert '\u0065\u0301' == accented_e assert accent in accented_e
def test_string_operators(self): hello = FuzzyString("heLlO") self.assertEqual(hello + "!", "helLo!") self.assertNotEqual(hello + "!", "hello") self.assertTrue("he" in hello) self.assertIn("He", hello) self.assertNotIn("He!", hello)
def test_string_operators(self): hello = FuzzyString("heLlO") assert hello + "!" == "helLo!" assert hello + "!" != "hello" assert "he" in hello assert "He!" not in hello # Additional test between the FuzzyString objects new_delhi = FuzzyString("NeW DELhi") new = FuzzyString("New") delhi = FuzzyString("Delhi") assert new + " " + delhi == new_delhi assert new + delhi != new_delhi assert delhi in new_delhi assert new in new_delhi
def test_string_operators(self): hello = FuzzyString("heLlO") self.assertEqual(hello + "!", "helLo!") self.assertNotEqual(hello + "!", "hello") self.assertTrue("he" in hello) self.assertIn("He", hello) self.assertNotIn("He!", hello) # Additional test between the FuzzyString objects new_delhi = FuzzyString("NeW DELhi") new = FuzzyString("New") delhi = FuzzyString("Delhi") self.assertEqual(new + " " + delhi, new_delhi) self.assertNotEqual(new + delhi, new_delhi) self.assertTrue(delhi in new_delhi) self.assertIn(new, new_delhi)
def test_other_string_comparisons(self): apple = FuzzyString("Apple") self.assertGreater(apple, "animal") self.assertLess("animal", apple) self.assertFalse(apple < "animal") self.assertFalse("animal" > apple) self.assertGreaterEqual(apple, "animal") self.assertGreaterEqual(apple, "apple") self.assertLessEqual("animal", apple) self.assertLessEqual("animal", "animal") self.assertFalse(apple <= "animal") self.assertFalse("animal" >= apple)
def test_string_representation(self): hello = FuzzyString("heLlO") self.assertEqual(str(hello), "heLlO") self.assertEqual(repr(hello), repr("heLlO"))
def test_equality_and_inequality_with_different_case_string(self): hello = FuzzyString("hellO") self.assertEqual(hello, "Hello") self.assertFalse(hello != "Hello") self.assertEqual(hello, "HELLO") self.assertFalse(hello != "HELLO")
def test_equality_with_completely_different_string(self): hello = FuzzyString("hello") self.assertNotEqual(hello, "Hello there") self.assertFalse(hello == "Hello there") self.assertNotEqual(hello, "hello there") self.assertFalse(hello == "Hello there")
def test_equality_and_inequality_with_same_string(self): hello = FuzzyString("hello") self.assertEqual(hello, "hello") self.assertFalse(hello != "hello")
def test_constructor(self): FuzzyString("hello")
def test_slicing(self): hello = FuzzyString("heLlO") assert hello[-1] == "O" assert hello[:] == "heLlO" assert hello[1:3] == "eL"
def test_equality_and_inequality_with_same_string(self): hello = FuzzyString("hello") assert hello == "hello" assert not hello != "hello"
def test_string_representation(self): hello = FuzzyString("heLlO") assert str(hello) == "heLlO" assert repr(hello) == repr("heLlO")
def test_equality_and_inequality_with_different_case_string(self): hello = FuzzyString("hellO") assert hello == "Hello" assert not hello != "Hello" assert hello == "HELLO" assert not hello != "HELLO"
def test_equality_with_completely_different_string(self): hello = FuzzyString("hello") assert hello != "Hello there" assert not hello == "Hello there" assert hello != "hello there" assert not hello == "Hello there"