Пример #1
0
 def test_random_text(self):
     func = random_text()
     text = func()
     self.assertRegexpMatches(text, r'^[a-zA-Z]{10}$')
     text2 = func()
     self.assertNotEqual(text, text2)
Пример #2
0
 def test_random_text_with_other_chars(self):
     func = random_text(1000, other_chars=[',', '.'])
     text = func()
     self.assertNotRegexpMatches(text, r'^[a-zA-Z]{1000}$')
     self.assertRegexpMatches(text, r'^[a-zA-Z.,]{1000}$')
Пример #3
0
 def test_random_text_with_no_uppercase(self):
     func = random_text(1000, upper=False)
     text = func()
     self.assertRegexpMatches(text, r'^[a-z]{1000}$')
Пример #4
0
 def test_random_text_with_spaces(self):
     func = random_text(1000, spaces=True)
     text = func()
     self.assertNotRegexpMatches(text, r'^[a-zA-Z]{1000}$')
     self.assertRegexpMatches(text, r'^[a-zA-Z\s]{1000}$')
Пример #5
0
 def test_random_text_with_digits(self):
     func = random_text(1000, digits=True)
     text = func()
     self.assertNotRegexpMatches(text, r'^[a-zA-Z]{1000}$')
     self.assertRegexpMatches(text, r'^[a-zA-Z0-9]{1000}$')
Пример #6
0
 def test_random_text_of_length(self):
     func = random_text(15)
     text = func()
     self.assertEqual(15, len(text))
Пример #7
0
 def test_random_text_of_length(self):
     func = random_text(15)
     text = func()
     self.assertEqual(15, len(text))
Пример #8
0
 def test_random_text(self):
     func = random_text()
     text = func()
     self.assertRegexpMatches(text, r'^[a-zA-Z]{10}$')
     text2 = func()
     self.assertNotEqual(text, text2)
Пример #9
0
 def test_random_text_with_no_uppercase(self):
     func = random_text(1000, upper=False)
     text = func()
     self.assertRegexpMatches(text, r'^[a-z]{1000}$')
Пример #10
0
 def test_random_text_with_other_chars(self):
     func = random_text(1000, other_chars=[',','.'])
     text = func()
     self.assertNotRegexpMatches(text, r'^[a-zA-Z]{1000}$')
     self.assertRegexpMatches(text, r'^[a-zA-Z.,]{1000}$')
Пример #11
0
 def test_random_text_with_digits(self):
     func = random_text(1000, digits=True)
     text = func()
     self.assertNotRegexpMatches(text, r'^[a-zA-Z]{1000}$')
     self.assertRegexpMatches(text, r'^[a-zA-Z0-9]{1000}$')
Пример #12
0
 def test_random_text_with_spaces(self):
     func = random_text(1000, spaces=True)
     text = func()
     self.assertNotRegexpMatches(text, r'^[a-zA-Z]{1000}$')
     self.assertRegexpMatches(text, r'^[a-zA-Z\s]{1000}$')