Exemplo n.º 1
0
 def test_operator_decorator(self):
     self.assertTrue(StringType("foo").equal_to.is_operator)
Exemplo n.º 2
0
 def test_string_matches_regex(self):
     self.assertTrue(StringType("hello").matches_regex(r"^h"))
     self.assertFalse(StringType("hello").matches_regex(r"^sh"))
Exemplo n.º 3
0
 def test_non_empty(self):
     self.assertTrue(StringType("hello").non_empty())
     self.assertFalse(StringType("").non_empty())
     self.assertFalse(StringType(None).non_empty())
Exemplo n.º 4
0
 def test_string_contains(self):
     self.assertTrue(StringType("hello").contains("ell"))
     self.assertTrue(StringType("hello").contains("he"))
     self.assertTrue(StringType("hello").contains("lo"))
     self.assertFalse(StringType("hello").contains("asdf"))
     self.assertFalse(StringType("hello").contains("ElL"))
Exemplo n.º 5
0
 def test_string_ends_with(self):
     self.assertTrue(StringType("hello").ends_with("lo"))
     self.assertFalse(StringType("hello").ends_with("boom"))
     self.assertFalse(StringType("hello").ends_with("Lo"))
Exemplo n.º 6
0
 def test_string_starts_with(self):
     self.assertTrue(StringType("hello").starts_with("he"))
     self.assertFalse(StringType("hello").starts_with("hey"))
     self.assertFalse(StringType("hello").starts_with("He"))
Exemplo n.º 7
0
 def test_string_equal_to_case_insensitive(self):
     self.assertTrue(StringType("foo").equal_to_case_insensitive("FOo"))
     self.assertTrue(StringType("foo").equal_to_case_insensitive("foo"))
     self.assertFalse(StringType("foo").equal_to_case_insensitive("blah"))
Exemplo n.º 8
0
 def test_string_equal_to(self):
     self.assertTrue(StringType("foo").equal_to("foo"))
     self.assertFalse(StringType("foo").equal_to("Foo"))