MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_binary_equality

Method test_binary_equality

test/orm/test_unitofwork.py:300–322  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

298
299 @testing.requires.non_broken_binary
300 def test_binary_equality(self):
301 Foo, t1 = self.classes.Foo, self.tables.t1
302
303 # data = b("this is some data")
304 data = b"m\x18" # m\xf2\r\n\x7f\x10'
305
306 self.mapper_registry.map_imperatively(Foo, t1)
307
308 s = fixture_session()
309
310 f1 = Foo(data=data)
311 s.add(f1)
312 s.flush()
313 s.expire_all()
314 f1 = s.query(Foo).first()
315 assert f1.data == data
316 f1.data = data
317 eq_(sa.orm.attributes.get_history(f1, "data"), ((), [data], ()))
318
319 def go():
320 s.flush()
321
322 self.assert_sql_count(testing.db, go, 0)
323
324
325class PKTest(fixtures.MappedTest):

Callers

nothing calls this directly

Calls 11

fixture_sessionFunction · 0.90
eq_Function · 0.90
map_imperativelyMethod · 0.80
assert_sql_countMethod · 0.80
FooClass · 0.70
addMethod · 0.45
flushMethod · 0.45
expire_allMethod · 0.45
firstMethod · 0.45
queryMethod · 0.45
get_historyMethod · 0.45

Tested by

no test coverage detected