def test_process_bind_param_none(self): """Assert UUIDs with other dialects are hex-encoded strings of length 32.""" guid = models.GUID() dialect = sqlite.dialect() result = guid.process_bind_param(None, dialect) self.assertTrue(result is None)
def test_load_dialect_impl_other(self): """Assert with dialects other than PostgreSQL, a CHAR type is used.""" guid = models.GUID() dialect = sqlite.dialect() result = guid.load_dialect_impl(dialect) self.assertTrue(isinstance(result, CHAR))
def test_load_dialect_impl_postgres(self): """Assert with PostgreSQL, a UUID type is used.""" guid = models.GUID() dialect = postgresql.dialect() result = guid.load_dialect_impl(dialect) self.assertTrue(isinstance(result, postgresql.UUID))
def test_process_result_string(self): """Assert when the result value is a string, a native UUID is returned.""" guid = models.GUID() uuid = uuid4() result = guid.process_result_value(str(uuid), sqlite.dialect()) self.assertTrue(isinstance(result, UUID)) self.assertEqual(uuid, result)
def test_process_bind_param_uuid_postgres(self): """Assert UUIDs with PostgreSQL are normal string representations of UUIDs.""" guid = models.GUID() uuid = uuid4() dialect = postgresql.dialect() result = guid.process_bind_param(uuid, dialect) self.assertEqual(str(uuid), result)
def test_process_bind_param_str_other(self): """Assert UUIDs with other dialects are hex-encoded strings of length 32.""" guid = models.GUID() uuid = uuid4() dialect = sqlite.dialect() result = guid.process_bind_param(str(uuid), dialect) self.assertEqual(32, len(result)) self.assertEqual(str(uuid).replace("-", ""), result)
def test_process_result_value_none(self): """Assert when the result value is None, None is returned.""" guid = models.GUID() self.assertTrue( guid.process_result_value(None, sqlite.dialect()) is None)