def test_length(self):
        default_length = 8
        self.assertEqual(len(_generate_hex_verification_code()), default_length,
                     "Verification code length does not match "\
                     "default expected length of %d." % default_length)
        self.assertEqual(len(_generate_hex_verification_code(length=10)), 10,
                     "Verification code length does not match expected length.")

        self.assertRaises(ValueError, _generate_hex_verification_code, 33)
        self.assertRaises(ValueError, _generate_hex_verification_code, 0)
        self.assertRaises(ValueError, _generate_hex_verification_code, -1)
        self.assertRaises(ValueError, _generate_hex_verification_code, 33)
        self.assertRaises(TypeError, _generate_hex_verification_code, None)
        self.assertRaises(TypeError, _generate_hex_verification_code, "")
 def test_is_string(self):
     self.assertTrue(is_bytes(_generate_hex_verification_code()),
                 "Verification code is not a byte string.")
 def test_uniqueness(self):
     self.assertNotEqual(_generate_hex_verification_code(),
                      _generate_hex_verification_code(),
                      "Verification code is not unique.")