MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_unicode

Method test_unicode

test/orm/test_query.py:1309–1329  ·  view source on GitHub ↗
(self, metadata, connection)

Source from the content-addressed store, hash-verified

1307
1308 @testing.requires.unicode_connections
1309 def test_unicode(self, metadata, connection):
1310 table = Table(
1311 "unicode_data",
1312 metadata,
1313 Column("id", Unicode(40), primary_key=True),
1314 Column("data", Unicode(40)),
1315 )
1316 metadata.create_all(connection)
1317 ustring = util.b("petit voix m\xe2\x80\x99a").decode("utf-8")
1318
1319 connection.execute(table.insert(), dict(id=ustring, data=ustring))
1320
1321 class LocalFoo(self.classes.Base):
1322 pass
1323
1324 self.mapper_registry.map_imperatively(LocalFoo, table)
1325 with Session(connection) as sess:
1326 eq_(
1327 sess.get(LocalFoo, ustring),
1328 LocalFoo(id=ustring, data=ustring),
1329 )
1330
1331
1332class InvalidGenerationsTest(QueryTest, AssertsCompiledSQL):

Callers

nothing calls this directly

Calls 12

TableClass · 0.90
ColumnClass · 0.90
UnicodeClass · 0.90
SessionClass · 0.90
eq_Function · 0.90
LocalFooClass · 0.85
create_allMethod · 0.80
bMethod · 0.80
map_imperativelyMethod · 0.80
executeMethod · 0.45
insertMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected