def test_other_invalid(self): for value in (None, True, lambda: None, 1): with self.assertRaises(Invalid): validate_uuid(value)
def test_hex(self): uid = uuid4() self.assertEqual(validate_uuid(uid.hex).hex, uid.hex)
def test_invalid_hex(self): with self.assertRaises(Invalid): validate_uuid("hello world")
def test_uuid(self): uid = uuid4() self.assertIs(validate_uuid(uid), uid)