MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_del_scalar_object

Method test_del_scalar_object

test/orm/test_attributes.py:406–431  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

404 )
405
406 def test_del_scalar_object(self):
407 class Foo:
408 pass
409
410 class Bar:
411 pass
412
413 instrumentation.register_class(Foo)
414 instrumentation.register_class(Bar)
415 _register_attribute(Foo, "b", uselist=False, useobject=True)
416
417 f1 = Foo()
418
419 is_(f1.b, None)
420
421 f1.b = Bar()
422
423 del f1.b
424 is_(f1.b, None)
425
426 def go():
427 del f1.b
428
429 assert_raises_message(
430 AttributeError, "Foo.b object does not have a value", go
431 )
432
433 def test_del_collection_object(self):
434 class Foo:

Callers

nothing calls this directly

Calls 5

is_Function · 0.90
assert_raises_messageFunction · 0.90
_register_attributeFunction · 0.70
FooClass · 0.70
BarClass · 0.70

Tested by

no test coverage detected