diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2012-07-18 16:43:02 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2012-07-18 16:43:02 -0400 |
| commit | 9c0de7fcf7fc56701af446742fe876335aef15b1 (patch) | |
| tree | 5fb52bc62b39c9ac9c9f87285443d02d6d39678a /test | |
| parent | dff7c2ad2c913ed0ec5979ff9470dd5dd5813483 (diff) | |
| download | sqlalchemy-9c0de7fcf7fc56701af446742fe876335aef15b1.tar.gz | |
- with InstanceState more public, underscore all its methods
that change object state as these aren't intended for public
use.
Diffstat (limited to 'test')
| -rw-r--r-- | test/ext/test_extendedattr.py | 16 | ||||
| -rw-r--r-- | test/orm/inheritance/test_basic.py | 2 | ||||
| -rw-r--r-- | test/orm/test_attributes.py | 204 | ||||
| -rw-r--r-- | test/orm/test_query.py | 122 | ||||
| -rw-r--r-- | test/orm/test_sync.py | 32 |
5 files changed, 188 insertions, 188 deletions
diff --git a/test/ext/test_extendedattr.py b/test/ext/test_extendedattr.py index 7143f2eed..286c1905f 100644 --- a/test/ext/test_extendedattr.py +++ b/test/ext/test_extendedattr.py @@ -157,7 +157,7 @@ class UserDefinedExtensionTest(fixtures.ORMTest): u.email_address = 'lala@123.com' self.assert_(u.user_id == 7 and u.user_name == 'john' and u.email_address == 'lala@123.com') - attributes.instance_state(u).commit_all(attributes.instance_dict(u)) + attributes.instance_state(u)._commit_all(attributes.instance_dict(u)) self.assert_(u.user_id == 7 and u.user_name == 'john' and u.email_address == 'lala@123.com') u.user_name = 'heythere' @@ -186,21 +186,21 @@ class UserDefinedExtensionTest(fixtures.ORMTest): assert Foo in instrumentation._instrumentation_factory._state_finders f = Foo() - attributes.instance_state(f).expire(attributes.instance_dict(f), set()) + attributes.instance_state(f)._expire(attributes.instance_dict(f), set()) eq_(f.a, "this is a") eq_(f.b, 12) f.a = "this is some new a" - attributes.instance_state(f).expire(attributes.instance_dict(f), set()) + attributes.instance_state(f)._expire(attributes.instance_dict(f), set()) eq_(f.a, "this is a") eq_(f.b, 12) - attributes.instance_state(f).expire(attributes.instance_dict(f), set()) + attributes.instance_state(f)._expire(attributes.instance_dict(f), set()) f.a = "this is another new a" eq_(f.a, "this is another new a") eq_(f.b, 12) - attributes.instance_state(f).expire(attributes.instance_dict(f), set()) + attributes.instance_state(f)._expire(attributes.instance_dict(f), set()) eq_(f.a, "this is a") eq_(f.b, 12) @@ -208,7 +208,7 @@ class UserDefinedExtensionTest(fixtures.ORMTest): eq_(f.a, None) eq_(f.b, 12) - attributes.instance_state(f).commit_all(attributes.instance_dict(f)) + attributes.instance_state(f)._commit_all(attributes.instance_dict(f)) eq_(f.a, None) eq_(f.b, 12) @@ -303,8 +303,8 @@ class UserDefinedExtensionTest(fixtures.ORMTest): f1.bars.append(b1) eq_(attributes.get_state_history(attributes.instance_state(f1), 'bars'), ([b1], [], [])) - attributes.instance_state(f1).commit_all(attributes.instance_dict(f1)) - attributes.instance_state(b1).commit_all(attributes.instance_dict(b1)) + attributes.instance_state(f1)._commit_all(attributes.instance_dict(f1)) + attributes.instance_state(b1)._commit_all(attributes.instance_dict(b1)) eq_(attributes.get_state_history(attributes.instance_state(f1), 'name'), ((), ['f1'], ())) eq_(attributes.get_state_history(attributes.instance_state(f1), 'bars'), ((), [b1], ())) diff --git a/test/orm/inheritance/test_basic.py b/test/orm/inheritance/test_basic.py index 052f8a9bf..6c3a34e3e 100644 --- a/test/orm/inheritance/test_basic.py +++ b/test/orm/inheritance/test_basic.py @@ -1639,7 +1639,7 @@ class OptimizedLoadTest(fixtures.MappedTest): ['counter2']) is None s1.id = 1 - attributes.instance_state(s1).commit_all(s1.__dict__, None) + attributes.instance_state(s1)._commit_all(s1.__dict__, None) assert m._optimized_get_statement(attributes.instance_state(s1), ['counter2']) is not None diff --git a/test/orm/test_attributes.py b/test/orm/test_attributes.py index 28c24ff66..bff29feb6 100644 --- a/test/orm/test_attributes.py +++ b/test/orm/test_attributes.py @@ -45,7 +45,7 @@ class AttributeImplAPITest(fixtures.MappedTest): b2 = B() A.b.impl.append( - attributes.instance_state(a1), + attributes.instance_state(a1), attributes.instance_dict(a1), b1, None ) @@ -56,7 +56,7 @@ class AttributeImplAPITest(fixtures.MappedTest): "Object <B at .*?> not " "associated with <A at .*?> on attribute 'b'", A.b.impl.remove, - attributes.instance_state(a1), + attributes.instance_state(a1), attributes.instance_dict(a1), b2, None ) @@ -68,14 +68,14 @@ class AttributeImplAPITest(fixtures.MappedTest): b2 = B() A.b.impl.append( - attributes.instance_state(a1), + attributes.instance_state(a1), attributes.instance_dict(a1), b1, None ) assert a1.b is b1 A.b.impl.pop( - attributes.instance_state(a1), + attributes.instance_state(a1), attributes.instance_dict(a1), b2, None ) assert a1.b is b1 @@ -87,14 +87,14 @@ class AttributeImplAPITest(fixtures.MappedTest): b1 = B() A.b.impl.append( - attributes.instance_state(a1), + attributes.instance_state(a1), attributes.instance_dict(a1), b1, None ) assert a1.b is b1 A.b.impl.pop( - attributes.instance_state(a1), + attributes.instance_state(a1), attributes.instance_dict(a1), b1, None ) assert a1.b is None @@ -107,7 +107,7 @@ class AttributeImplAPITest(fixtures.MappedTest): b2 = B() A.b.impl.append( - attributes.instance_state(a1), + attributes.instance_state(a1), attributes.instance_dict(a1), b1, None ) @@ -117,7 +117,7 @@ class AttributeImplAPITest(fixtures.MappedTest): ValueError, r"list.remove\(x\): x not in list", A.b.impl.remove, - attributes.instance_state(a1), + attributes.instance_state(a1), attributes.instance_dict(a1), b2, None ) @@ -129,14 +129,14 @@ class AttributeImplAPITest(fixtures.MappedTest): b2 = B() A.b.impl.append( - attributes.instance_state(a1), + attributes.instance_state(a1), attributes.instance_dict(a1), b1, None ) assert a1.b == [b1] A.b.impl.pop( - attributes.instance_state(a1), + attributes.instance_state(a1), attributes.instance_dict(a1), b2, None ) assert a1.b == [b1] @@ -148,14 +148,14 @@ class AttributeImplAPITest(fixtures.MappedTest): b1 = B() A.b.impl.append( - attributes.instance_state(a1), + attributes.instance_state(a1), attributes.instance_dict(a1), b1, None ) assert a1.b == [b1] A.b.impl.pop( - attributes.instance_state(a1), + attributes.instance_state(a1), attributes.instance_dict(a1), b1, None ) assert a1.b == [] @@ -188,7 +188,7 @@ class AttributesTest(fixtures.ORMTest): u.email_address = 'lala@123.com' self.assert_(u.user_id == 7 and u.user_name == 'john' and u.email_address == 'lala@123.com') - attributes.instance_state(u).commit_all(attributes.instance_dict(u)) + attributes.instance_state(u)._commit_all(attributes.instance_dict(u)) self.assert_(u.user_id == 7 and u.user_name == 'john' and u.email_address == 'lala@123.com') u.user_name = 'heythere' @@ -294,9 +294,9 @@ class AttributesTest(fixtures.ORMTest): instrumentation.register_class(Foo) instrumentation.register_class(Bar) - attributes.register_attribute(Foo, - 'bars', - uselist=True, + attributes.register_attribute(Foo, + 'bars', + uselist=True, useobject=True) assert_raises_message( @@ -323,28 +323,28 @@ class AttributesTest(fixtures.ORMTest): attributes.register_attribute(Foo, 'b', uselist=False, useobject=False) f = Foo() - attributes.instance_state(f).expire(attributes.instance_dict(f), + attributes.instance_state(f)._expire(attributes.instance_dict(f), set()) eq_(f.a, 'this is a') eq_(f.b, 12) f.a = 'this is some new a' - attributes.instance_state(f).expire(attributes.instance_dict(f), + attributes.instance_state(f)._expire(attributes.instance_dict(f), set()) eq_(f.a, 'this is a') eq_(f.b, 12) - attributes.instance_state(f).expire(attributes.instance_dict(f), + attributes.instance_state(f)._expire(attributes.instance_dict(f), set()) f.a = 'this is another new a' eq_(f.a, 'this is another new a') eq_(f.b, 12) - attributes.instance_state(f).expire(attributes.instance_dict(f), + attributes.instance_state(f)._expire(attributes.instance_dict(f), set()) eq_(f.a, 'this is a') eq_(f.b, 12) del f.a eq_(f.a, None) eq_(f.b, 12) - attributes.instance_state(f).commit_all(attributes.instance_dict(f), + attributes.instance_state(f)._commit_all(attributes.instance_dict(f), set()) eq_(f.a, None) eq_(f.b, 12) @@ -363,7 +363,7 @@ class AttributesTest(fixtures.ORMTest): attributes.register_attribute(MyTest, 'b', uselist=False, useobject=False) m = MyTest() - attributes.instance_state(m).expire(attributes.instance_dict(m), set()) + attributes.instance_state(m)._expire(attributes.instance_dict(m), set()) assert 'a' not in m.__dict__ m2 = pickle.loads(pickle.dumps(m)) assert 'a' not in m2.__dict__ @@ -399,7 +399,7 @@ class AttributesTest(fixtures.ORMTest): self.assert_(u.user_id == 7 and u.user_name == 'john' and u.addresses[0].email_address == 'lala@123.com') (u, - attributes.instance_state(a).commit_all(attributes.instance_dict(a))) + attributes.instance_state(a)._commit_all(attributes.instance_dict(a))) self.assert_(u.user_id == 7 and u.user_name == 'john' and u.addresses[0].email_address == 'lala@123.com') @@ -433,17 +433,17 @@ class AttributesTest(fixtures.ORMTest): def append(self, state, child, initiator): if commit: - state.commit_all(state.dict) + state._commit_all(state.dict) return child def remove(self, state, child, initiator): if commit: - state.commit_all(state.dict) + state._commit_all(state.dict) return child def set(self, state, child, oldchild, initiator): if commit: - state.commit_all(state.dict) + state._commit_all(state.dict) return child instrumentation.register_class(Foo) @@ -461,26 +461,26 @@ class AttributesTest(fixtures.ORMTest): return attributes.PASSIVE_NO_RESULT return b2 - attributes.register_attribute(Foo, 'bars', - uselist=True, - useobject=True, + attributes.register_attribute(Foo, 'bars', + uselist=True, + useobject=True, callable_=loadcollection, extension=[ReceiveEvents('bars')]) - attributes.register_attribute(Foo, 'bar', - uselist=False, - useobject=True, + attributes.register_attribute(Foo, 'bar', + uselist=False, + useobject=True, callable_=loadscalar, extension=[ReceiveEvents('bar')]) - attributes.register_attribute(Foo, 'scalar', - uselist=False, + attributes.register_attribute(Foo, 'scalar', + uselist=False, useobject=False, extension=[ReceiveEvents('scalar')]) def create_hist(): def hist(key, shouldmatch, fn, *arg): - attributes.instance_state(f1).commit_all(attributes.instance_dict(f1)) + attributes.instance_state(f1)._commit_all(attributes.instance_dict(f1)) fn(*arg) histories.append((shouldmatch, attributes.get_history(f1, key))) @@ -552,7 +552,7 @@ class AttributesTest(fixtures.ORMTest): x.bars b = Bar(id=4) b.foos.append(x) - attributes.instance_state(x).expire_attributes(attributes.instance_dict(x), + attributes.instance_state(x)._expire_attributes(attributes.instance_dict(x), ['bars']) assert_raises(AssertionError, b.foos.remove, x) @@ -595,7 +595,7 @@ class AttributesTest(fixtures.ORMTest): ]) def test_lazytrackparent(self): - """test that the "hasparent" flag works properly + """test that the "hasparent" flag works properly when lazy loaders and backrefs are used """ @@ -616,11 +616,11 @@ class AttributesTest(fixtures.ORMTest): # create objects as if they'd been freshly loaded from the database (without history) b = Blog() p1 = Post() - attributes.instance_state(b).set_callable(attributes.instance_dict(b), + attributes.instance_state(b)._set_callable(attributes.instance_dict(b), 'posts', lambda passive:[p1]) - attributes.instance_state(p1).set_callable(attributes.instance_dict(p1), + attributes.instance_state(p1)._set_callable(attributes.instance_dict(p1), 'blog', lambda passive:b) - p1, attributes.instance_state(b).commit_all(attributes.instance_dict(b)) + p1, attributes.instance_state(b)._commit_all(attributes.instance_dict(b)) # no orphans (called before the lazy loaders fire off) assert attributes.has_parent(Blog, p1, 'posts', optimistic=True) @@ -672,11 +672,11 @@ class AttributesTest(fixtures.ORMTest): return "this is the bar attr" def func3(state, passive): return "this is the shared attr" - attributes.register_attribute(Foo, 'element', uselist=False, + attributes.register_attribute(Foo, 'element', uselist=False, callable_=func1, useobject=True) - attributes.register_attribute(Foo, 'element2', uselist=False, + attributes.register_attribute(Foo, 'element2', uselist=False, callable_=func3, useobject=True) - attributes.register_attribute(Bar, 'element', uselist=False, + attributes.register_attribute(Bar, 'element', uselist=False, callable_=func2, useobject=True) x = Foo() @@ -728,7 +728,7 @@ class AttributesTest(fixtures.ORMTest): x.element = el eq_(attributes.get_state_history(attributes.instance_state(x), 'element'), ([el], (), ())) - attributes.instance_state(x).commit_all(attributes.instance_dict(x)) + attributes.instance_state(x)._commit_all(attributes.instance_dict(x)) added, unchanged, deleted = \ attributes.get_state_history(attributes.instance_state(x), 'element') @@ -761,7 +761,7 @@ class AttributesTest(fixtures.ORMTest): attributes.register_attribute(Bar, 'id', uselist=False, useobject=True) x = Foo() - attributes.instance_state(x).commit_all(attributes.instance_dict(x)) + attributes.instance_state(x)._commit_all(attributes.instance_dict(x)) x.col2.append(bar4) eq_(attributes.get_state_history(attributes.instance_state(x), 'col2'), ([bar4], [bar1, bar2, bar3], [])) @@ -905,12 +905,12 @@ class GetNoValueTest(fixtures.ORMTest): instrumentation.register_class(Foo) instrumentation.register_class(Bar) if expected is not None: - attributes.register_attribute(Foo, - "attr", useobject=True, + attributes.register_attribute(Foo, + "attr", useobject=True, uselist=False, callable_=lazy_callable) else: - attributes.register_attribute(Foo, - "attr", useobject=True, + attributes.register_attribute(Foo, + "attr", useobject=True, uselist=False) f1 = Foo() @@ -1054,7 +1054,7 @@ class BackrefTest(fixtures.ORMTest): instrumentation.register_class(Port) instrumentation.register_class(Jack) - attributes.register_attribute(Port, 'jack', uselist=False, + attributes.register_attribute(Port, 'jack', uselist=False, useobject=True, backref="port") attributes.register_attribute(Jack, 'port', uselist=False, @@ -1227,7 +1227,7 @@ class PendingBackrefTest(fixtures.ORMTest): p4.blog = b assert called[0] == 0 eq_(attributes.instance_state(b). - get_history('posts', attributes.PASSIVE_OFF), + get_history('posts', attributes.PASSIVE_OFF), ([p, p4], [p1, p2, p3], [])) assert called[0] == 1 @@ -1250,7 +1250,7 @@ class PendingBackrefTest(fixtures.ORMTest): lazy_load = [p, p2] # lazy loaded + pending get added together. # This isn't seen often with the ORM due - # to usual practices surrounding the + # to usual practices surrounding the # load/flush/load cycle. eq_(b.posts, [p, p2, p]) eq_(called[0], 1) @@ -1283,8 +1283,8 @@ class PendingBackrefTest(fixtures.ORMTest): b = Blog("blog 1") p1.blog = b - attributes.instance_state(b).commit_all(attributes.instance_dict(b)) - attributes.instance_state(p1).commit_all(attributes.instance_dict(p1)) + attributes.instance_state(b)._commit_all(attributes.instance_dict(b)) + attributes.instance_state(p1)._commit_all(attributes.instance_dict(p1)) assert b.posts == [Post("post 1")] class HistoryTest(fixtures.TestBase): @@ -1295,7 +1295,7 @@ class HistoryTest(fixtures.TestBase): instrumentation.register_class(Foo) attributes.register_attribute( - Foo, 'someattr', + Foo, 'someattr', uselist=uselist, useobject=useobject, active_history=active_history, @@ -1321,7 +1321,7 @@ class HistoryTest(fixtures.TestBase): 'someattr') def _commit_someattr(self, f): - attributes.instance_state(f).commit(attributes.instance_dict(f), + attributes.instance_state(f)._commit(attributes.instance_dict(f), ['someattr']) def _someattr_committed_state(self, f): @@ -1331,20 +1331,20 @@ class HistoryTest(fixtures.TestBase): attributes.instance_dict(f)) def test_committed_value_init(self): - Foo = self._fixture(uselist=False, useobject=False, + Foo = self._fixture(uselist=False, useobject=False, active_history=False) f = Foo() eq_(self._someattr_committed_state(f), None) def test_committed_value_set(self): - Foo = self._fixture(uselist=False, useobject=False, + Foo = self._fixture(uselist=False, useobject=False, active_history=False) f = Foo() f.someattr = 3 eq_(self._someattr_committed_state(f), None) def test_committed_value_set_commit(self): - Foo = self._fixture(uselist=False, useobject=False, + Foo = self._fixture(uselist=False, useobject=False, active_history=False) f = Foo() f.someattr = 3 @@ -1352,25 +1352,25 @@ class HistoryTest(fixtures.TestBase): eq_(self._someattr_committed_state(f), 3) def test_scalar_init(self): - Foo = self._fixture(uselist=False, useobject=False, + Foo = self._fixture(uselist=False, useobject=False, active_history=False) f = Foo() eq_(self._someattr_history(f), ((), (), ())) def test_object_init(self): - Foo = self._fixture(uselist=False, useobject=True, + Foo = self._fixture(uselist=False, useobject=True, active_history=False) f = Foo() eq_(self._someattr_history(f), ((), (), ())) def test_object_init_active_history(self): - Foo = self._fixture(uselist=False, useobject=True, + Foo = self._fixture(uselist=False, useobject=True, active_history=True) f = Foo() eq_(self._someattr_history(f), ((), (), ())) def test_scalar_no_init_side_effect(self): - Foo = self._fixture(uselist=False, useobject=False, + Foo = self._fixture(uselist=False, useobject=False, active_history=False) f = Foo() self._someattr_history(f) @@ -1379,14 +1379,14 @@ class HistoryTest(fixtures.TestBase): assert 'someattr' not in attributes.instance_state(f).committed_state def test_scalar_set(self): - Foo = self._fixture(uselist=False, useobject=False, + Foo = self._fixture(uselist=False, useobject=False, active_history=False) f = Foo() f.someattr = 'hi' eq_(self._someattr_history(f), (['hi'], (), ())) def test_scalar_set_commit(self): - Foo = self._fixture(uselist=False, useobject=False, + Foo = self._fixture(uselist=False, useobject=False, active_history=False) f = Foo() f.someattr = 'hi' @@ -1394,7 +1394,7 @@ class HistoryTest(fixtures.TestBase): eq_(self._someattr_history(f), ((), ['hi'], ())) def test_scalar_set_commit_reset(self): - Foo = self._fixture(uselist=False, useobject=False, + Foo = self._fixture(uselist=False, useobject=False, active_history=False) f = Foo() f.someattr = 'hi' @@ -1403,7 +1403,7 @@ class HistoryTest(fixtures.TestBase): eq_(self._someattr_history(f), (['there'], (), ['hi'])) def test_scalar_set_commit_reset_commit(self): - Foo = self._fixture(uselist=False, useobject=False, + Foo = self._fixture(uselist=False, useobject=False, active_history=False) f = Foo() f.someattr = 'hi' @@ -1413,7 +1413,7 @@ class HistoryTest(fixtures.TestBase): eq_(self._someattr_history(f), ((), ['there'], ())) def test_scalar_set_commit_reset_commit_del(self): - Foo = self._fixture(uselist=False, useobject=False, + Foo = self._fixture(uselist=False, useobject=False, active_history=False) f = Foo() f.someattr = 'there' @@ -1422,14 +1422,14 @@ class HistoryTest(fixtures.TestBase): eq_(self._someattr_history(f), ((), (), ['there'])) def test_scalar_set_dict(self): - Foo = self._fixture(uselist=False, useobject=False, + Foo = self._fixture(uselist=False, useobject=False, active_history=False) f = Foo() f.__dict__['someattr'] = 'new' eq_(self._someattr_history(f), ((), ['new'], ())) def test_scalar_set_dict_set(self): - Foo = self._fixture(uselist=False, useobject=False, + Foo = self._fixture(uselist=False, useobject=False, active_history=False) f = Foo() f.__dict__['someattr'] = 'new' @@ -1438,7 +1438,7 @@ class HistoryTest(fixtures.TestBase): eq_(self._someattr_history(f), (['old'], (), ['new'])) def test_scalar_set_dict_set_commit(self): - Foo = self._fixture(uselist=False, useobject=False, + Foo = self._fixture(uselist=False, useobject=False, active_history=False) f = Foo() f.__dict__['someattr'] = 'new' @@ -1448,14 +1448,14 @@ class HistoryTest(fixtures.TestBase): eq_(self._someattr_history(f), ((), ['old'], ())) def test_scalar_set_None(self): - Foo = self._fixture(uselist=False, useobject=False, + Foo = self._fixture(uselist=False, useobject=False, active_history=False) f = Foo() f.someattr = None eq_(self._someattr_history(f), ([None], (), ())) def test_scalar_set_None_from_dict_set(self): - Foo = self._fixture(uselist=False, useobject=False, + Foo = self._fixture(uselist=False, useobject=False, active_history=False) f = Foo() f.__dict__['someattr'] = 'new' @@ -1463,7 +1463,7 @@ class HistoryTest(fixtures.TestBase): eq_(self._someattr_history(f), ([None], (), ['new'])) def test_scalar_set_twice_no_commit(self): - Foo = self._fixture(uselist=False, useobject=False, + Foo = self._fixture(uselist=False, useobject=False, active_history=False) f = Foo() f.someattr = 'one' @@ -1472,13 +1472,13 @@ class HistoryTest(fixtures.TestBase): eq_(self._someattr_history(f), (['two'], (), ())) def test_scalar_active_init(self): - Foo = self._fixture(uselist=False, useobject=False, + Foo = self._fixture(uselist=False, useobject=False, active_history=True) f = Foo() eq_(self._someattr_history(f), ((), (), ())) def test_scalar_active_no_init_side_effect(self): - Foo = self._fixture(uselist=False, useobject=False, + Foo = self._fixture(uselist=False, useobject=False, active_history=True) f = Foo() self._someattr_history(f) @@ -1487,14 +1487,14 @@ class HistoryTest(fixtures.TestBase): assert 'someattr' not in attributes.instance_state(f).committed_state def test_scalar_active_set(self): - Foo = self._fixture(uselist=False, useobject=False, + Foo = self._fixture(uselist=False, useobject=False, active_history=True) f = Foo() f.someattr = 'hi' eq_(self._someattr_history(f), (['hi'], (), ())) def test_scalar_active_set_commit(self): - Foo = self._fixture(uselist=False, useobject=False, + Foo = self._fixture(uselist=False, useobject=False, active_history=True) f = Foo() f.someattr = 'hi' @@ -1502,7 +1502,7 @@ class HistoryTest(fixtures.TestBase): eq_(self._someattr_history(f), ((), ['hi'], ())) def test_scalar_active_set_commit_reset(self): - Foo = self._fixture(uselist=False, useobject=False, + Foo = self._fixture(uselist=False, useobject=False, active_history=True) f = Foo() f.someattr = 'hi' @@ -1511,7 +1511,7 @@ class HistoryTest(fixtures.TestBase): eq_(self._someattr_history(f), (['there'], (), ['hi'])) def test_scalar_active_set_commit_reset_commit(self): - Foo = self._fixture(uselist=False, useobject=False, + Foo = self._fixture(uselist=False, useobject=False, active_history=True) f = Foo() f.someattr = 'hi' @@ -1521,7 +1521,7 @@ class HistoryTest(fixtures.TestBase): eq_(self._someattr_history(f), ((), ['there'], ())) def test_scalar_active_set_commit_reset_commit_del(self): - Foo = self._fixture(uselist=False, useobject=False, + Foo = self._fixture(uselist=False, useobject=False, active_history=True) f = Foo() f.someattr = 'there' @@ -1530,14 +1530,14 @@ class HistoryTest(fixtures.TestBase): eq_(self._someattr_history(f), ((), (), ['there'])) def test_scalar_active_set_dict(self): - Foo = self._fixture(uselist=False, useobject=False, + Foo = self._fixture(uselist=False, useobject=False, active_history=True) f = Foo() f.__dict__['someattr'] = 'new' eq_(self._someattr_history(f), ((), ['new'], ())) def test_scalar_active_set_dict_set(self): - Foo = self._fixture(uselist=False, useobject=False, + Foo = self._fixture(uselist=False, useobject=False, active_history=True) f = Foo() f.__dict__['someattr'] = 'new' @@ -1546,7 +1546,7 @@ class HistoryTest(fixtures.TestBase): eq_(self._someattr_history(f), (['old'], (), ['new'])) def test_scalar_active_set_dict_set_commit(self): - Foo = self._fixture(uselist=False, useobject=False, + Foo = self._fixture(uselist=False, useobject=False, active_history=True) f = Foo() f.__dict__['someattr'] = 'new' @@ -1556,14 +1556,14 @@ class HistoryTest(fixtures.TestBase): eq_(self._someattr_history(f), ((), ['old'], ())) def test_scalar_active_set_None(self): - Foo = self._fixture(uselist=False, useobject=False, + Foo = self._fixture(uselist=False, useobject=False, active_history=True) f = Foo() f.someattr = None eq_(self._someattr_history(f), ([None], (), ())) def test_scalar_active_set_None_from_dict_set(self): - Foo = self._fixture(uselist=False, useobject=False, + Foo = self._fixture(uselist=False, useobject=False, active_history=True) f = Foo() f.__dict__['someattr'] = 'new' @@ -1571,7 +1571,7 @@ class HistoryTest(fixtures.TestBase): eq_(self._someattr_history(f), ([None], (), ['new'])) def test_scalar_active_set_twice_no_commit(self): - Foo = self._fixture(uselist=False, useobject=False, + Foo = self._fixture(uselist=False, useobject=False, active_history=True) f = Foo() f.someattr = 'one' @@ -1582,14 +1582,14 @@ class HistoryTest(fixtures.TestBase): def test_scalar_inplace_mutation_set(self): - Foo = self._fixture(uselist=False, useobject=False, + Foo = self._fixture(uselist=False, useobject=False, active_history=False) f = Foo() f.someattr = {'a': 'b'} eq_(self._someattr_history(f), ([{'a': 'b'}], (), ())) def test_scalar_inplace_mutation_set_commit(self): - Foo = self._fixture(uselist=False, useobject=False, + Foo = self._fixture(uselist=False, useobject=False, active_history=False) f = Foo() f.someattr = {'a': 'b'} @@ -1597,7 +1597,7 @@ class HistoryTest(fixtures.TestBase): eq_(self._someattr_history(f), ((), [{'a': 'b'}], ())) def test_scalar_inplace_mutation_set_commit_set(self): - Foo = self._fixture(uselist=False, useobject=False, + Foo = self._fixture(uselist=False, useobject=False, active_history=False) f = Foo() f.someattr = {'a': 'b'} @@ -1606,7 +1606,7 @@ class HistoryTest(fixtures.TestBase): eq_(self._someattr_history(f), ((), [{'a': 'c'}], ())) def test_scalar_inplace_mutation_set_commit_flag_modified(self): - Foo = self._fixture(uselist=False, useobject=False, + Foo = self._fixture(uselist=False, useobject=False, active_history=False) f = Foo() f.someattr = {'a': 'b'} @@ -1615,7 +1615,7 @@ class HistoryTest(fixtures.TestBase): eq_(self._someattr_history(f), ([{'a': 'b'}], (), ())) def test_scalar_inplace_mutation_set_commit_set_flag_modified(self): - Foo = self._fixture(uselist=False, useobject=False, + Foo = self._fixture(uselist=False, useobject=False, active_history=False) f = Foo() f.someattr = {'a': 'b'} @@ -1625,7 +1625,7 @@ class HistoryTest(fixtures.TestBase): eq_(self._someattr_history(f), ([{'a': 'c'}], (), ())) def test_scalar_inplace_mutation_set_commit_flag_modified_set(self): - Foo = self._fixture(uselist=False, useobject=False, + Foo = self._fixture(uselist=False, useobject=False, active_history=False) f = Foo() f.someattr = {'a': 'b'} @@ -1782,7 +1782,7 @@ class HistoryTest(fixtures.TestBase): f = Foo() collection = attributes.init_collection(f, 'someattr') collection.append_without_event(new) - attributes.instance_state(f).commit_all(attributes.instance_dict(f)) + attributes.instance_state(f)._commit_all(attributes.instance_dict(f)) eq_(attributes.get_state_history(attributes.instance_state(f), 'someattr'), ((), [new], ())) f.someattr = [old] @@ -1868,7 +1868,7 @@ class HistoryTest(fixtures.TestBase): f.someattr.append(new) eq_(attributes.get_state_history(attributes.instance_state(f), 'someattr'), ([old, new], [hi], [there])) - attributes.instance_state(f).commit(attributes.instance_dict(f), + attributes.instance_state(f)._commit(attributes.instance_dict(f), ['someattr']) eq_(attributes.get_state_history(attributes.instance_state(f), 'someattr'), ((), [hi, old, new], ())) @@ -1883,20 +1883,20 @@ class HistoryTest(fixtures.TestBase): f.__dict__['id'] = 1 collection = attributes.init_collection(f, 'someattr') collection.append_without_event(new) - attributes.instance_state(f).commit_all(attributes.instance_dict(f)) + attributes.instance_state(f)._commit_all(attributes.instance_dict(f)) eq_(attributes.get_state_history(attributes.instance_state(f), 'someattr'), ((), [new], ())) f.someattr.append(old) eq_(attributes.get_state_history(attributes.instance_state(f), 'someattr'), ([old], [new], [])) - attributes.instance_state(f).commit(attributes.instance_dict(f), + attributes.instance_state(f)._commit(attributes.instance_dict(f), ['someattr']) eq_(attributes.get_state_history(attributes.instance_state(f), 'someattr'), ((), [new, old], ())) f = Foo() collection = attributes.init_collection(f, 'someattr') collection.append_without_event(new) - attributes.instance_state(f).commit_all(attributes.instance_dict(f)) + attributes.instance_state(f)._commit_all(attributes.instance_dict(f)) eq_(attributes.get_state_history(attributes.instance_state(f), 'someattr'), ((), [new], ())) f.id = 1 @@ -1925,7 +1925,7 @@ class HistoryTest(fixtures.TestBase): f.someattr.append(hi) eq_(attributes.get_state_history(attributes.instance_state(f), 'someattr'), ([hi, there, hi], [], [])) - attributes.instance_state(f).commit_all(attributes.instance_dict(f)) + attributes.instance_state(f)._commit_all(attributes.instance_dict(f)) eq_(attributes.get_state_history(attributes.instance_state(f), 'someattr'), ((), [hi, there, hi], ())) f.someattr = [] @@ -2020,7 +2020,7 @@ class LazyloadHistoryTest(fixtures.TestBase): eq_(attributes.get_state_history(attributes.instance_state(f), 'bars'), ([bar4], [], [])) lazy_load = [bar1, bar2, bar3] - attributes.instance_state(f).expire_attributes(attributes.instance_dict(f), + attributes.instance_state(f)._expire_attributes(attributes.instance_dict(f), ['bars']) eq_(attributes.get_state_history(attributes.instance_state(f), 'bars'), ((), [bar1, bar2, bar3], ())) @@ -2306,8 +2306,8 @@ class ListenerTest(fixtures.ORMTest): (make_a, make_b), (make_b, make_c) ] - elements = [make_a, make_b, make_c, - instrument_a, instrument_b, instrument_c, + elements = [make_a, make_b, make_c, + instrument_a, instrument_b, instrument_c, attr_a, attr_b, attr_c, events_a] for i, series in enumerate(all_partial_orderings(ordering, elements)): diff --git a/test/orm/test_query.py b/test/orm/test_query.py index fcda72a8a..e8d6c0901 100644 --- a/test/orm/test_query.py +++ b/test/orm/test_query.py @@ -176,7 +176,7 @@ class GetTest(QueryTest): assert_raises(sa_exc.InvalidRequestError, q.get, (5, )) def test_get_null_pk(self): - """test that a mapping which can have None in a + """test that a mapping which can have None in a PK (i.e. map to an outerjoin) works with get().""" users, addresses = self.tables.users, self.tables.addresses @@ -317,7 +317,7 @@ class GetTest(QueryTest): s = create_session() q = s.query(User).filter(User.id==1) eq_( - str(q).replace('\n',''), + str(q).replace('\n',''), 'SELECT users.id AS users_id, users.name AS users_name FROM users WHERE users.id = ?' ) @@ -432,21 +432,21 @@ class InvalidGenerationsTest(QueryTest, AssertsCompiledSQL): s = create_session() q = s.query(User).order_by(User.id) - self.assert_compile(q, + self.assert_compile(q, "SELECT users.id AS users_id, users.name AS users_name FROM users ORDER BY users.id", use_default_dialect=True) assert_raises(sa_exc.InvalidRequestError, q._no_select_modifiers, "foo") q = q.order_by(None) - self.assert_compile(q, + self.assert_compile(q, "SELECT users.id AS users_id, users.name AS users_name FROM users", use_default_dialect=True) assert_raises(sa_exc.InvalidRequestError, q._no_select_modifiers, "foo") q = q.order_by(False) - self.assert_compile(q, + self.assert_compile(q, "SELECT users.id AS users_id, users.name AS users_name FROM users", use_default_dialect=True) @@ -498,7 +498,7 @@ class OperatorTest(QueryTest, AssertsCompiledSQL): create_session().query(User) for (py_op, sql_op) in ((operator.add, '+'), (operator.mul, '*'), - (operator.sub, '-'), + (operator.sub, '-'), # Py3k #(operator.truediv, '/'), # Py2K @@ -579,14 +579,14 @@ class OperatorTest(QueryTest, AssertsCompiledSQL): def test_relationship(self): User, Address = self.classes.User, self.classes.Address - self._test(User.addresses.any(Address.id==17), + self._test(User.addresses.any(Address.id==17), "EXISTS (SELECT 1 " "FROM addresses " "WHERE users.id = addresses.user_id AND addresses.id = :id_1)" ) u7 = User(id=7) - attributes.instance_state(u7).commit_all(attributes.instance_dict(u7)) + attributes.instance_state(u7)._commit_all(attributes.instance_dict(u7)) self._test(Address.user == u7, ":param_1 = addresses.user_id") @@ -600,7 +600,7 @@ class OperatorTest(QueryTest, AssertsCompiledSQL): Node = self.classes.Node nalias = aliased(Node) self._test( - nalias.parent.has(Node.data=='some data'), + nalias.parent.has(Node.data=='some data'), "EXISTS (SELECT 1 FROM nodes WHERE nodes.id = nodes_1.parent_id AND nodes.data = :data_1)" ) @@ -611,14 +611,14 @@ class OperatorTest(QueryTest, AssertsCompiledSQL): # auto self-referential aliasing self._test( - Node.children.any(Node.data=='n1'), + Node.children.any(Node.data=='n1'), "EXISTS (SELECT 1 FROM nodes AS nodes_1 WHERE " "nodes.id = nodes_1.parent_id AND nodes_1.data = :data_1)" ) # needs autoaliasing self._test( - Node.children==None, + Node.children==None, "NOT (EXISTS (SELECT 1 FROM nodes AS nodes_1 WHERE nodes.id = nodes_1.parent_id))" ) @@ -633,44 +633,44 @@ class OperatorTest(QueryTest, AssertsCompiledSQL): ) self._test( - nalias.children==None, + nalias.children==None, "NOT (EXISTS (SELECT 1 FROM nodes WHERE nodes_1.id = nodes.parent_id))" ) self._test( - nalias.children.any(Node.data=='some data'), + nalias.children.any(Node.data=='some data'), "EXISTS (SELECT 1 FROM nodes WHERE " "nodes_1.id = nodes.parent_id AND nodes.data = :data_1)") # fails, but I think I want this to fail #self._test( - # Node.children.any(nalias.data=='some data'), + # Node.children.any(nalias.data=='some data'), # "EXISTS (SELECT 1 FROM nodes AS nodes_1 WHERE " # "nodes.id = nodes_1.parent_id AND nodes_1.data = :data_1)" # ) self._test( - nalias.parent.has(Node.data=='some data'), + nalias.parent.has(Node.data=='some data'), "EXISTS (SELECT 1 FROM nodes WHERE nodes.id = nodes_1.parent_id AND nodes.data = :data_1)" ) self._test( - Node.parent.has(Node.data=='some data'), + Node.parent.has(Node.data=='some data'), "EXISTS (SELECT 1 FROM nodes AS nodes_1 WHERE nodes_1.id = nodes.parent_id AND nodes_1.data = :data_1)" ) self._test( - Node.parent == Node(id=7), + Node.parent == Node(id=7), ":param_1 = nodes.parent_id" ) self._test( - nalias.parent == Node(id=7), + nalias.parent == Node(id=7), ":param_1 = nodes_1.parent_id" ) self._test( - nalias.parent != Node(id=7), + nalias.parent != Node(id=7), 'nodes_1.parent_id != :parent_id_1 OR nodes_1.parent_id IS NULL' ) @@ -745,7 +745,7 @@ class ExpressionTest(QueryTest, AssertsCompiledSQL): self.classes.Address) session = create_session() - s = session.query(User).filter(and_(addresses.c.email_address == bindparam('emailad'), + s = session.query(User).filter(and_(addresses.c.email_address == bindparam('emailad'), Address.user_id==User.id)).statement l = list(session.query(User).instances(s.execute(emailad = 'jack@bean.com'))) @@ -816,7 +816,7 @@ class ExpressionTest(QueryTest, AssertsCompiledSQL): q = session.query(User.id).filter(User.id==7).label('foo') self.assert_compile( - session.query(q), + session.query(q), "SELECT (SELECT users.id FROM users WHERE users.id = :id_1) AS foo" ) @@ -886,7 +886,7 @@ class ExpressionTest(QueryTest, AssertsCompiledSQL): s = create_session() - # TODO: do we want aliased() to detect a query and convert to subquery() + # TODO: do we want aliased() to detect a query and convert to subquery() # automatically ? q1 = s.query(Address).filter(Address.email_address=='jack@bean.com') adalias = aliased(Address, q1.subquery()) @@ -1179,9 +1179,9 @@ class FilterTest(QueryTest, AssertsCompiledSQL): ) # o2o - eq_([Address(id=1), Address(id=3), Address(id=4)], + eq_([Address(id=1), Address(id=3), Address(id=4)], sess.query(Address).filter(Address.dingaling==None).order_by(Address.id).all()) - eq_([Address(id=1), Address(id=3), Address(id=4)], + eq_([Address(id=1), Address(id=3), Address(id=4)], sess.query(Address).filter(Address.dingaling==null()).order_by(Address.id).all()) eq_([Address(id=2), Address(id=5)], sess.query(Address).filter(Address.dingaling != None).order_by(Address.id).all()) eq_([Address(id=2), Address(id=5)], sess.query(Address).filter(Address.dingaling != null()).order_by(Address.id).all()) @@ -1244,11 +1244,11 @@ class SetOpsTest(QueryTest, AssertsCompiledSQL): ed = s.query(User).filter(User.name=='ed') jack = s.query(User).filter(User.name=='jack') - eq_(fred.union(ed).order_by(User.name).all(), + eq_(fred.union(ed).order_by(User.name).all(), [User(name='ed'), User(name='fred')] ) - eq_(fred.union(ed, jack).order_by(User.name).all(), + eq_(fred.union(ed, jack).order_by(User.name).all(), [User(name='ed'), User(name='fred'), User(name='jack')] ) @@ -1274,7 +1274,7 @@ class SetOpsTest(QueryTest, AssertsCompiledSQL): ) def test_union_literal_expressions_compile(self): - """test that column expressions translate during + """test that column expressions translate during the _from_statement() portion of union(), others""" User = self.classes.User @@ -1314,13 +1314,13 @@ class SetOpsTest(QueryTest, AssertsCompiledSQL): for q in (q3.order_by(User.id, "anon_1_param_1"), q6.order_by(User.id, "foo")): eq_(q.all(), [ - (User(id=7, name=u'jack'), u'x'), - (User(id=7, name=u'jack'), u'y'), - (User(id=8, name=u'ed'), u'x'), - (User(id=8, name=u'ed'), u'y'), - (User(id=9, name=u'fred'), u'x'), - (User(id=9, name=u'fred'), u'y'), - (User(id=10, name=u'chuck'), u'x'), + (User(id=7, name=u'jack'), u'x'), + (User(id=7, name=u'jack'), u'y'), + (User(id=8, name=u'ed'), u'x'), + (User(id=8, name=u'ed'), u'y'), + (User(id=9, name=u'fred'), u'x'), + (User(id=9, name=u'fred'), u'y'), + (User(id=10, name=u'chuck'), u'x'), (User(id=10, name=u'chuck'), u'y') ] ) @@ -1414,11 +1414,11 @@ class SetOpsTest(QueryTest, AssertsCompiledSQL): fred = s.query(User).filter(User.name=='fred') ed = s.query(User).filter(User.name=='ed') jack = s.query(User).filter(User.name=='jack') - eq_(fred.intersect(ed, jack).all(), + eq_(fred.intersect(ed, jack).all(), [] ) - eq_(fred.union(ed).intersect(ed.union(jack)).all(), + eq_(fred.union(ed).intersect(ed.union(jack)).all(), [User(name='ed')] ) @@ -1433,9 +1433,9 @@ class SetOpsTest(QueryTest, AssertsCompiledSQL): def go(): eq_( - fred.union(ed).order_by(User.name).options(joinedload(User.addresses)).all(), + fred.union(ed).order_by(User.name).options(joinedload(User.addresses)).all(), [ - User(name='ed', addresses=[Address(), Address(), Address()]), + User(name='ed', addresses=[Address(), Address(), Address()]), User(name='fred', addresses=[Address()]) ] ) @@ -1481,7 +1481,7 @@ class CountTest(QueryTest): s = create_session() # '*' is favored here as the most common character, # it is reported that Informix doesn't like count(1), - # rumors about Oracle preferring count(1) don't appear + # rumors about Oracle preferring count(1) don't appear # to be well founded. self.assert_sql_execution( testing.db, @@ -1490,7 +1490,7 @@ class CountTest(QueryTest): "SELECT count(*) AS count_1 FROM " "(SELECT users.id AS users_id, users.name " "AS users_name FROM users) AS anon_1", - {} + {} ) ) @@ -1551,9 +1551,9 @@ class DistinctTest(QueryTest): create_session().query(User).order_by(User.id).distinct().all() ) eq_( - [User(id=7), User(id=9), User(id=8),User(id=10)], + [User(id=7), User(id=9), User(id=8),User(id=10)], create_session().query(User).distinct().order_by(desc(User.name)).all() - ) + ) def test_joined(self): """test that orderbys from a joined table get placed into the columns clause when DISTINCT is used""" @@ -1897,8 +1897,8 @@ class SynonymTest(QueryTest): options(joinedload(User.orders_syn)).all() eq_(result, [ User(id=7, name='jack', orders=[ - Order(description=u'order 1'), - Order(description=u'order 3'), + Order(description=u'order 1'), + Order(description=u'order 3'), Order(description=u'order 5') ]) ]) @@ -1913,8 +1913,8 @@ class SynonymTest(QueryTest): options(joinedload(User.orders_syn_2)).all() eq_(result, [ User(id=7, name='jack', orders=[ - Order(description=u'order 1'), - Order(description=u'order 3'), + Order(description=u'order 1'), + Order(description=u'order 3'), Order(description=u'order 5') ]) ]) @@ -1929,8 +1929,8 @@ class SynonymTest(QueryTest): options(joinedload('orders_syn_2')).all() eq_(result, [ User(id=7, name='jack', orders=[ - Order(description=u'order 1'), - Order(description=u'order 3'), + Order(description=u'order 1'), + Order(description=u'order 3'), Order(description=u'order 5') ]) ]) @@ -1969,7 +1969,7 @@ class SynonymTest(QueryTest): u1 = q.filter_by(**{nameprop:'jack'}).one() o = sess.query(Order).with_parent(u1, property=orderprop).all() - assert [Order(description="order 1"), + assert [Order(description="order 1"), Order(description="order 3"), Order(description="order 5")] == o @@ -2026,7 +2026,7 @@ class ImmediateTest(_fixtures.FixtureTest): sess.query(User, Address).join(User.addresses).one) # this result returns multiple rows, the first - # two rows being the same. but uniquing is + # two rows being the same. but uniquing is # not applied for a column based result. assert_raises(sa.orm.exc.MultipleResultsFound, sess.query(User.id). @@ -2035,10 +2035,10 @@ class ImmediateTest(_fixtures.FixtureTest): order_by(User.id). one) - # test that a join which ultimately returns - # multiple identities across many rows still - # raises, even though the first two rows are of - # the same identity and unique filtering + # test that a join which ultimately returns + # multiple identities across many rows still + # raises, even though the first two rows are of + # the same identity and unique filtering # is applied ([ticket:1688]) assert_raises(sa.orm.exc.MultipleResultsFound, sess.query(User). @@ -2198,7 +2198,7 @@ class OptionsTest(QueryTest): opt = self._option_fixture("orders.items.keywords") self._assert_path_result(opt, q, [ - (User, 'orders'), + (User, 'orders'), (User, 'orders', Order, 'items'), (User, 'orders', Order, 'items', Item, 'keywords') ]) @@ -2213,7 +2213,7 @@ class OptionsTest(QueryTest): opt = self._option_fixture(User.orders, Order.items, Item.keywords) self._assert_path_result(opt, q, [ - (User, 'orders'), + (User, 'orders'), (User, 'orders', Order, 'items'), (User, 'orders', Order, 'items', Item, 'keywords') ]) @@ -2535,7 +2535,7 @@ class OptionsNoPropTest(_fixtures.FixtureTest): r"Mapper\|Keyword\|keywords in this Query." ) - @testing.fails_if(lambda:True, + @testing.fails_if(lambda:True, "PropertyOption doesn't yet check for relation/column on end result") def test_option_against_non_relation_basestring(self): Item = self.classes.Item @@ -2547,7 +2547,7 @@ class OptionsNoPropTest(_fixtures.FixtureTest): "does not refer to a mapped entity" ) - @testing.fails_if(lambda:True, + @testing.fails_if(lambda:True, "PropertyOption doesn't yet check for relation/column on end result") def test_option_against_multi_non_relation_basestring(self): Item = self.classes.Item @@ -2649,7 +2649,7 @@ class OptionsNoPropTest(_fixtures.FixtureTest): @classmethod def setup_mappers(cls): users, User, addresses, Address, orders, Order = ( - cls.tables.users, cls.classes.User, + cls.tables.users, cls.classes.User, cls.tables.addresses, cls.classes.Address, cls.tables.orders, cls.classes.Order) mapper(User, users, properties={ @@ -2678,9 +2678,9 @@ class OptionsNoPropTest(_fixtures.FixtureTest): key = ('loaderstrategy', (class_mapper(Item), 'keywords')) assert key in q._attributes - def _assert_eager_with_entity_exception(self, entity_list, options, + def _assert_eager_with_entity_exception(self, entity_list, options, message): - assert_raises_message(sa.exc.ArgumentError, + assert_raises_message(sa.exc.ArgumentError, message, create_session().query(*entity_list).options, *options) diff --git a/test/orm/test_sync.py b/test/orm/test_sync.py index 178d396b9..9134e47ce 100644 --- a/test/orm/test_sync.py +++ b/test/orm/test_sync.py @@ -21,7 +21,7 @@ class AssertsUOW(object): uow.register_object(d, isdelete=True) return uow -class SyncTest(fixtures.MappedTest, +class SyncTest(fixtures.MappedTest, testing.AssertsExecutionResults, AssertsUOW): @classmethod @@ -89,11 +89,11 @@ class SyncTest(fixtures.MappedTest, "Can't execute sync rule for source column 't2.id'; " r"mapper 'Mapper\|A\|t1' does not map this column.", sync.populate, - a1, - a_mapper, - b1, - b_mapper, - pairs, + a1, + a_mapper, + b1, + b_mapper, + pairs, uowcommit, False ) @@ -105,11 +105,11 @@ class SyncTest(fixtures.MappedTest, "Can't execute sync rule for destination " r"column 't1.id'; mapper 'Mapper\|B\|t2' does not map this column.", sync.populate, - a1, - a_mapper, - b1, - b_mapper, - pairs, + a1, + a_mapper, + b1, + b_mapper, + pairs, uowcommit, False ) @@ -147,7 +147,7 @@ class SyncTest(fixtures.MappedTest, def test_update(self): uowcommit, a1, b1, a_mapper, b_mapper = self._fixture() a1.obj().id = 10 - a1.commit_all(a1.dict) + a1._commit_all(a1.dict) a1.obj().id = 12 pairs = [(a_mapper.c.id, b_mapper.c.id,)] dest = {} @@ -190,25 +190,25 @@ class SyncTest(fixtures.MappedTest, a1.obj().id = 10 pairs = [(a_mapper.c.id, b_mapper.c.id,)] eq_( - sync.source_modified(uowcommit, a1, a_mapper, pairs), + sync.source_modified(uowcommit, a1, a_mapper, pairs), False ) def test_source_modified_no_pairs(self): uowcommit, a1, b1, a_mapper, b_mapper = self._fixture() eq_( - sync.source_modified(uowcommit, a1, a_mapper, []), + sync.source_modified(uowcommit, a1, a_mapper, []), False ) def test_source_modified_modified(self): uowcommit, a1, b1, a_mapper, b_mapper = self._fixture() a1.obj().id = 10 - a1.commit_all(a1.dict) + a1._commit_all(a1.dict) a1.obj().id = 12 pairs = [(a_mapper.c.id, b_mapper.c.id,)] eq_( - sync.source_modified(uowcommit, a1, a_mapper, pairs), + sync.source_modified(uowcommit, a1, a_mapper, pairs), True ) |
