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