Skip to content

Commit

Permalink
Resolve SQLAlchemy deprecation warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
amol- committed Mar 15, 2024
1 parent 49e968e commit 96d74b0
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion tests/test_stack/rendering/test_pagination.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ def setup_class(self):
self.s = SQLASession(connection)

def test_relationship(self):
t = self.s.query(MTest1).get(1)
t = self.s.get(MTest1, 1)
p = Page(t.test2s, items_per_page=1, page=1)
assert len(list(p)) == 1
assert list(p)[0].val == 'fred', list(p)
Expand Down
3 changes: 2 additions & 1 deletion tests/test_stack/test_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,8 @@ def app(environ, start_response):

try:
next(resp)
except:
next(resp)
except AssertionError:
# Looping again will crash because we already popped
# The registered object and cleanup will fail.
pass
2 changes: 1 addition & 1 deletion tests/test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ class Test(object):
connection.execute(testtable.insert(), {'id': 3, 'val': 'alberto'})

sess = Session(connection)
getunless = unless(sess.query(Test).get)
getunless = unless(lambda x: sess.get(Test, x))

x = getunless(1)
assert x.val == 'bob', x
Expand Down
2 changes: 1 addition & 1 deletion tg/util/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def unless(func, check=None):
to fail validation when querying objects from the database
if they do not exist::
Convert(unless(DBSession.query(User).get))
Convert(unless(lambda uid: DBSession.get(User, uid)))
"""
@wraps(func)
Expand Down

0 comments on commit 96d74b0

Please sign in to comment.