summaryrefslogtreecommitdiff
path: root/test/ext/test_mutable.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2013-06-23 17:53:49 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2013-06-23 17:53:49 -0400
commit786c5fe31672a0aebd49ba97f7a79ccdddad6ba1 (patch)
treebe8d0cd14bd255b70494e62b476c66b4bfdf7a3c /test/ext/test_mutable.py
parent1f42aca57182e524487a500a6b49d495cda1e1b6 (diff)
downloadsqlalchemy-786c5fe31672a0aebd49ba97f7a79ccdddad6ba1.tar.gz
- add a test for pullreq 8
- simplify
Diffstat (limited to 'test/ext/test_mutable.py')
-rw-r--r--test/ext/test_mutable.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/ext/test_mutable.py b/test/ext/test_mutable.py
index bda9e5382..25c182f1d 100644
--- a/test/ext/test_mutable.py
+++ b/test/ext/test_mutable.py
@@ -421,6 +421,32 @@ class MutableCompositesTest(_CompositeTestBase, fixtures.MappedTest):
eq_(f1.data.x, 5)
+class MutableCompositeCallableTest(_CompositeTestBase, fixtures.MappedTest):
+
+ @classmethod
+ def setup_mappers(cls):
+ foo = cls.tables.foo
+
+ Point = cls._type_fixture()
+
+ # in this case, this is not actually a MutableComposite.
+ # so we don't expect it to track changes
+ mapper(Foo, foo, properties={
+ 'data': composite(lambda x, y: Point(x, y), foo.c.x, foo.c.y)
+ })
+
+ def test_basic(self):
+ sess = Session()
+ f1 = Foo(data=Point(3, 4))
+ sess.add(f1)
+ sess.flush()
+ f1.data.x = 5
+ sess.commit()
+
+ # we didn't get the change.
+ eq_(f1.data.x, 3)
+
+
class MutableCompositeCustomCoerceTest(_CompositeTestBase, fixtures.MappedTest):
@classmethod
def _type_fixture(cls):