示例#1
0
 def test_operator_decorator(self):
     self.assertTrue(StringType("foo").equal_to.is_operator)
示例#2
0
 def test_string_matches_regex(self):
     self.assertTrue(StringType("hello").matches_regex(r"^h"))
     self.assertFalse(StringType("hello").matches_regex(r"^sh"))
示例#3
0
 def test_non_empty(self):
     self.assertTrue(StringType("hello").non_empty())
     self.assertFalse(StringType("").non_empty())
     self.assertFalse(StringType(None).non_empty())
示例#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"))
示例#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"))
示例#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"))
示例#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"))
示例#8
0
 def test_string_equal_to(self):
     self.assertTrue(StringType("foo").equal_to("foo"))
     self.assertFalse(StringType("foo").equal_to("Foo"))