def test_character_returns_default_numbers_true(self): chars = 'abcdefghijklmnopqrstuvwxyz!@#$%^&*()[]' chars += chars.upper() chars += '1234567890' for x in range(100): ch = chance.character(symbols=False) self.assertTrue(chars.find(ch) >= 0)
def test_character_returns_only_alpha_and_numbers(self): chars = 'abcdefghijklmnopqrstuvwxyz' chars += chars.upper() chars += '1234567890' for x in range(100): ch = chance.character(symbols=False, alpha=True, numbers=True) self.assertTrue(chars.find(ch) >= 0)
def test_character_returns_only_lower_alpha_with_symbols_and_numbers(self): chars = 'abcdefghijklmnopqrstuvwxyz' chars += '!@#$%^&*()[]' chars += '1234567890' for x in range(100): ch = chance.character(case='lower', symbols=True, numbers=True) self.assertTrue(chars.find(ch) >= 0)
def test_character_returns_only_symbols(self): chars = '!@#$%^&*()[]' for x in range(100): ch = chance.character(symbols=True, alpha=False) self.assertTrue(chars.find(ch) >= 0)
def test_character_returns_character_default_params(self): chars = 'abcdefghijklmnopqrstuvwxyz!@#$%^&*()[]' chars += chars.upper() for x in range(100): ch = chance.character() self.assertTrue(chars.find(ch) >= 0)
def test_character_returns_character_only_symbols_and_numbers(self): chars = '!@#$%^&*()[]' chars += '1234567890' for x in range(100): ch = chance.character(symbols=True, alpha=False, numbers=True) self.assertTrue(chars.find(ch) >= 0)
def test_character_returns_only_lowecase_alpha(self): chars = 'abcdefghijklmnopqrstuvwxyz' for x in range(100): ch = chance.character(case='lower', symbols=False, numbers=False) self.assertTrue(chars.find(ch) >= 0)
def test_character_returns_only_uppercase_alpha_and_symbols(self): chars = 'abcdefghijklmnopqrstuvwxyz'.upper() chars += '!@#$%^&*()[]' for x in range(100): ch = chance.character(case='upper', symbols=True, numbers=False) self.assertTrue(chars.find(ch) >= 0)
def test_character_is_in_pool (self): chars = [chance.character (pool=string.digits) for x in range(25)] map (lambda c: self.assertIn (c, string.digits), chars)