Skip to content

Commit

Permalink
Use session add_all to add multiple elements
Browse files Browse the repository at this point in the history
  • Loading branch information
juliotrigo committed Jan 4, 2017
1 parent cf870c2 commit 0d1803d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 16 deletions.
10 changes: 2 additions & 8 deletions test/interface/test_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,7 @@ def multiple_bars_inserted(self, session):
bar_2 = Bar(id=2, name='name_2', count=10)
bar_3 = Bar(id=3, name='name_1', count=None)
bar_4 = Bar(id=4, name='name_4', count=15)
session.add(bar_1)
session.add(bar_2)
session.add(bar_3)
session.add(bar_4)
session.add_all([bar_1, bar_2, bar_3, bar_4])
session.commit()


Expand Down Expand Up @@ -549,10 +546,7 @@ def multiple_quxs_inserted(self, session):
created_at=datetime.date(2016, 7, 14),
execution_time=datetime.datetime(2016, 7, 14, 3, 5, 9)
)
session.add(qux_1)
session.add(qux_2)
session.add(qux_3)
session.add(qux_4)
session.add_all([qux_1, qux_2, qux_3, qux_4])
session.commit()


Expand Down
11 changes: 3 additions & 8 deletions test/interface/test_pagination.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,9 @@ def multiple_bars_inserted(self, session):
bar_6 = Bar(id=6, name='name_5', count=17)
bar_7 = Bar(id=7, name='name_7', count=None)
bar_8 = Bar(id=8, name='name_8', count=18)
session.add(bar_1)
session.add(bar_2)
session.add(bar_3)
session.add(bar_4)
session.add(bar_5)
session.add(bar_6)
session.add(bar_7)
session.add(bar_8)
session.add_all(
[bar_1, bar_2, bar_3, bar_4, bar_5, bar_6, bar_7, bar_8]
)
session.commit()


Expand Down

0 comments on commit 0d1803d

Please sign in to comment.