def test_to_python_uuid(self): value = uuid.uuid4() instance = UUIDConverter(self.app.url_map) self.assertIs(instance.to_python(value), value)
def test_to_python_hex(self): value = uuid.uuid4() instance = UUIDConverter(self.app.url_map) self.assertEqual(value, instance.to_python(value.hex))
def test_to_url_bytes(self): value = uuid.uuid4() instance = UUIDConverter(self.app.url_map) self.assertEqual(instance.to_url(value.bytes), str(value))
def test_to_url_error(self): instance = UUIDConverter(self.app.url_map) with self.assertRaises(ValidationError): instance.to_url("")
def test_instance(self): instance = UUIDConverter(self.app.url_map) self.assertIsInstance(instance, BaseConverter)