MCPcopy Create free account
hub / github.com/sqlalchemy/sqlalchemy / test_ro_mapping_py3k

Method test_ro_mapping_py3k

test/sql/test_resultset.py:1491–1511  ·  view source on GitHub ↗
(self, connection)

Source from the content-addressed store, hash-verified

1489 eq_(row._mapping[s.c.user_name], "ed")
1490
1491 def test_ro_mapping_py3k(self, connection):
1492 users = self.tables.users
1493
1494 connection.execute(users.insert(), dict(user_id=1, user_name="foo"))
1495 result = connection.execute(users.select())
1496
1497 row = result.first()
1498 dict_row = row._asdict()
1499
1500 # dictionaries aren't ordered in Python 3 until 3.7
1501 odict_row = collections.OrderedDict(
1502 [("user_id", 1), ("user_name", "foo")]
1503 )
1504 eq_(dict_row, odict_row)
1505
1506 mapping_row = row._mapping
1507
1508 eq_(list(mapping_row), list(mapping_row.keys()))
1509 eq_(odict_row.keys(), mapping_row.keys())
1510 eq_(odict_row.values(), mapping_row.values())
1511 eq_(odict_row.items(), mapping_row.items())
1512
1513 @testing.combinations(
1514 (lambda result: result),

Callers

nothing calls this directly

Calls 9

eq_Function · 0.90
_asdictMethod · 0.80
executeMethod · 0.45
insertMethod · 0.45
selectMethod · 0.45
firstMethod · 0.45
keysMethod · 0.45
valuesMethod · 0.45
itemsMethod · 0.45

Tested by

no test coverage detected