summaryrefslogtreecommitdiff
path: root/test/ext/test_mutable.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2011-07-01 11:32:07 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2011-07-01 11:32:07 -0400
commit409a95adf44f577a204114469ff414bebefca293 (patch)
tree90429da5eba44a8073125c89a9927426083fd553 /test/ext/test_mutable.py
parent9ae8de1f65c89f33f4ffae33023e481955f72244 (diff)
downloadsqlalchemy-409a95adf44f577a204114469ff414bebefca293.tar.gz
- Fixed bug in the mutable extension whereby
if None or a non-corresponding type were set, an error would be raised. None is now accepted which assigns None to all attributes, illegal values raise ValueError.
Diffstat (limited to 'test/ext/test_mutable.py')
-rw-r--r--test/ext/test_mutable.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/ext/test_mutable.py b/test/ext/test_mutable.py
index 9d0a4a0c8..df4006c01 100644
--- a/test/ext/test_mutable.py
+++ b/test/ext/test_mutable.py
@@ -355,6 +355,24 @@ class MutableCompositesTest(_CompositeTestBase, fixtures.MappedTest):
f2.data.y = 12
assert f2 in sess.dirty
+ def test_set_none(self):
+ sess = Session()
+ f1 = Foo(data=None)
+ sess.add(f1)
+ sess.commit()
+ eq_(f1.data, Point(None, None))
+
+ f1.data.y = 5
+ sess.commit()
+ eq_(f1.data, Point(None, 5))
+
+ def test_set_illegal(self):
+ f1 = Foo()
+ assert_raises_message(
+ ValueError,
+ "Attribute 'data' does not accept objects",
+ setattr, f1, 'data', 'foo'
+ )
class MutableInheritedCompositesTest(_CompositeTestBase, fixtures.MappedTest):
@classmethod