fix: format all code with black
and from now on should not deviate from that...
This commit is contained in:
parent
49f9a0228b
commit
a6bb538ce9
59 changed files with 2762 additions and 2131 deletions
|
@ -22,20 +22,20 @@ else:
|
|||
# counter table should not exist yet
|
||||
metadata = sa.MetaData()
|
||||
metadata.reflect(self.session.bind)
|
||||
self.assertNotIn('_counter_testing', metadata.tables)
|
||||
self.assertNotIn("_counter_testing", metadata.tables)
|
||||
|
||||
# using sqlite as backend, should make table for counter
|
||||
value = handler.next_counter_value(self.session, 'testing')
|
||||
value = handler.next_counter_value(self.session, "testing")
|
||||
self.assertEqual(value, 1)
|
||||
|
||||
# counter table should exist now
|
||||
metadata.reflect(self.session.bind)
|
||||
self.assertIn('_counter_testing', metadata.tables)
|
||||
self.assertIn("_counter_testing", metadata.tables)
|
||||
|
||||
# counter increments okay
|
||||
value = handler.next_counter_value(self.session, 'testing')
|
||||
value = handler.next_counter_value(self.session, "testing")
|
||||
self.assertEqual(value, 2)
|
||||
value = handler.next_counter_value(self.session, 'testing')
|
||||
value = handler.next_counter_value(self.session, "testing")
|
||||
self.assertEqual(value, 3)
|
||||
|
||||
def test_next_counter_value_postgres(self):
|
||||
|
@ -44,20 +44,20 @@ else:
|
|||
# counter table should not exist
|
||||
metadata = sa.MetaData()
|
||||
metadata.reflect(self.session.bind)
|
||||
self.assertNotIn('_counter_testing', metadata.tables)
|
||||
self.assertNotIn("_counter_testing", metadata.tables)
|
||||
|
||||
# nb. we have to pretty much mock this out, can't really
|
||||
# test true sequence behavior for postgres since tests are
|
||||
# using sqlite backend.
|
||||
|
||||
# using postgres as backend, should use "sequence"
|
||||
with patch.object(handler, 'get_dialect', return_value='postgresql'):
|
||||
with patch.object(self.session, 'execute') as execute:
|
||||
with patch.object(handler, "get_dialect", return_value="postgresql"):
|
||||
with patch.object(self.session, "execute") as execute:
|
||||
execute.return_value.scalar.return_value = 1
|
||||
value = handler.next_counter_value(self.session, 'testing')
|
||||
value = handler.next_counter_value(self.session, "testing")
|
||||
self.assertEqual(value, 1)
|
||||
execute.return_value.scalar.assert_called_once_with()
|
||||
|
||||
# counter table should still not exist
|
||||
metadata.reflect(self.session.bind)
|
||||
self.assertNotIn('_counter_testing', metadata.tables)
|
||||
self.assertNotIn("_counter_testing", metadata.tables)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue