]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- add distinct tests for mapping to join with "exclude" prop versus "explicit",
authorMike Bayer <mike_mp@zzzcomputing.com>
Sat, 20 Nov 2010 20:28:18 +0000 (15:28 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sat, 20 Nov 2010 20:28:18 +0000 (15:28 -0500)
should be the last thing needed for [ticket:1896], related to [ticket:1892]

test/orm/test_mapper.py

index 4b36fbc342fa978c360bba79c5db3fe948047ac0..8360d54bfab9e8dd4d15fd5a0f4055f2e28f68dc 100644 (file)
@@ -525,18 +525,29 @@ class MapperTest(_fixtures.FixtureTest):
         )
 
     @testing.resolve_artifact_names
-    def test_mapping_to_join(self):
+    def test_mapping_to_join_explicit_prop(self):
         """Mapping to a join"""
 
         usersaddresses = sa.join(users, addresses, users.c.id
                                  == addresses.c.user_id)
         mapper(User, usersaddresses, primary_key=[users.c.id],
-               #exclude_properties=[addresses.c.id]
                properties={'add_id':addresses.c.id}
                )
         l = create_session().query(User).order_by(users.c.id).all()
         eq_(l, self.static.user_result[:3])
 
+    @testing.resolve_artifact_names
+    def test_mapping_to_join_exclude_prop(self):
+        """Mapping to a join"""
+
+        usersaddresses = sa.join(users, addresses, users.c.id
+                                 == addresses.c.user_id)
+        mapper(User, usersaddresses, primary_key=[users.c.id],
+               exclude_properties=[addresses.c.id]
+               )
+        l = create_session().query(User).order_by(users.c.id).all()
+        eq_(l, self.static.user_result[:3])
+
     @testing.resolve_artifact_names
     def test_mapping_to_join_no_pk(self):
         m = mapper(Address,