Пример #1
0
 def test_length__range(self):
     result = __unit__.random(self.LENGTH_RANGE)
     self.assertGreaterEqual(len(result), self.MIN_LENGTH)
     self.assertLessEqual(len(result), self.MAX_LENGTH)
Пример #2
0
 def test_length__invalid_tuple(self):
     with self.assertRaises(TypeError):
         __unit__.random((1, 2, 3))
Пример #3
0
 def test_length__constant(self):
     result = __unit__.random(self.LENGTH)
     self.assertEquals(self.LENGTH, len(result))
Пример #4
0
 def test_length__some_object(self):
     with self.assertRaises(TypeError):
         __unit__.random(object())
Пример #5
0
 def test_length__negative(self):
     with self.assertRaises(ValueError) as r:
         __unit__.random(self.NEGATIVE_LENGTH)
     self.assertIn(str(self.NEGATIVE_LENGTH), str(r.exception))
Пример #6
0
 def test_chars__empty_string(self):
     with self.assertRaises(ValueError) as r:
         __unit__.random(self.LENGTH, '')
     self.assertIn("empty", str(r.exception))
Пример #7
0
 def test_length__some_object(self):
     with self.assertRaises(TypeError):
         __unit__.random(object())
Пример #8
0
 def test_chars__non_string_iterable(self):
     with self.assertRaises(TypeError):
         __unit__.random(self.LENGTH, ('a', 'b'))
Пример #9
0
 def test_chars__empty_string(self):
     with self.assertRaises(ValueError) as r:
         __unit__.random(self.LENGTH, '')
     self.assertIn("empty", str(r.exception))
Пример #10
0
 def test_length__range(self):
     result = __unit__.random(self.LENGTH_RANGE)
     self.assertGreaterEqual(len(result), self.MIN_LENGTH)
     self.assertLessEqual(len(result), self.MAX_LENGTH)
Пример #11
0
 def test_chars__some_object(self):
     with self.assertRaises(TypeError):
         __unit__.random(self.LENGTH, object())
Пример #12
0
 def test_length__constant(self):
     result = __unit__.random(self.LENGTH)
     self.assertEquals(self.LENGTH, len(result))
Пример #13
0
 def test_length__invalid_tuple(self):
     with self.assertRaises(TypeError):
         __unit__.random((1, 2, 3))
Пример #14
0
 def test_length__negative(self):
     with self.assertRaises(ValueError) as r:
         __unit__.random(self.NEGATIVE_LENGTH)
     self.assertIn(str(self.NEGATIVE_LENGTH), str(r.exception))
Пример #15
0
 def test_chars__some_object(self):
     with self.assertRaises(TypeError):
         __unit__.random(self.LENGTH, object())
Пример #16
0
 def test_chars__string(self):
     result = __unit__.random(self.LENGTH, self.CHARSET)
     for char in result:
         self.assertIn(char, self.CHARSET)
Пример #17
0
 def test_chars__non_string_iterable(self):
     with self.assertRaises(TypeError):
         __unit__.random(self.LENGTH, ('a', 'b'))
Пример #18
0
 def test_length__none(self):
     with self.assertRaises(TypeError):
         __unit__.random(None)
Пример #19
0
 def test_chars__string(self):
     result = __unit__.random(self.LENGTH, self.CHARSET)
     for char in result:
         self.assertIn(char, self.CHARSET)
Пример #20
0
 def test_length__none(self):
     with self.assertRaises(TypeError):
         __unit__.random(None)