Example #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)
Example #2
0
 def test_length__invalid_tuple(self):
     with self.assertRaises(TypeError):
         __unit__.random((1, 2, 3))
Example #3
0
 def test_length__constant(self):
     result = __unit__.random(self.LENGTH)
     self.assertEquals(self.LENGTH, len(result))
Example #4
0
 def test_length__some_object(self):
     with self.assertRaises(TypeError):
         __unit__.random(object())
Example #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))
Example #6
0
 def test_chars__empty_string(self):
     with self.assertRaises(ValueError) as r:
         __unit__.random(self.LENGTH, '')
     self.assertIn("empty", str(r.exception))
Example #7
0
 def test_length__some_object(self):
     with self.assertRaises(TypeError):
         __unit__.random(object())
Example #8
0
 def test_chars__non_string_iterable(self):
     with self.assertRaises(TypeError):
         __unit__.random(self.LENGTH, ('a', 'b'))
Example #9
0
 def test_chars__empty_string(self):
     with self.assertRaises(ValueError) as r:
         __unit__.random(self.LENGTH, '')
     self.assertIn("empty", str(r.exception))
Example #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)
Example #11
0
 def test_chars__some_object(self):
     with self.assertRaises(TypeError):
         __unit__.random(self.LENGTH, object())
Example #12
0
 def test_length__constant(self):
     result = __unit__.random(self.LENGTH)
     self.assertEquals(self.LENGTH, len(result))
Example #13
0
 def test_length__invalid_tuple(self):
     with self.assertRaises(TypeError):
         __unit__.random((1, 2, 3))
Example #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))
Example #15
0
 def test_chars__some_object(self):
     with self.assertRaises(TypeError):
         __unit__.random(self.LENGTH, object())
Example #16
0
 def test_chars__string(self):
     result = __unit__.random(self.LENGTH, self.CHARSET)
     for char in result:
         self.assertIn(char, self.CHARSET)
Example #17
0
 def test_chars__non_string_iterable(self):
     with self.assertRaises(TypeError):
         __unit__.random(self.LENGTH, ('a', 'b'))
Example #18
0
 def test_length__none(self):
     with self.assertRaises(TypeError):
         __unit__.random(None)
Example #19
0
 def test_chars__string(self):
     result = __unit__.random(self.LENGTH, self.CHARSET)
     for char in result:
         self.assertIn(char, self.CHARSET)
Example #20
0
 def test_length__none(self):
     with self.assertRaises(TypeError):
         __unit__.random(None)