Revised the coding style in the test_init test of the BaseAccountCommandTestCase test case.

This commit is contained in:
依瑪貓 2023-02-08 10:47:55 +08:00
parent d58859bcf3
commit d8e0e30c41

View File

@ -68,9 +68,9 @@ class BaseAccountCommandTestCase(unittest.TestCase):
runner: FlaskCliRunner = self.app.test_cli_runner() runner: FlaskCliRunner = self.app.test_cli_runner()
result: Result = runner.invoke(args="accounting-init-base") result: Result = runner.invoke(args="accounting-init-base")
self.assertEqual(result.exit_code, 0) self.assertEqual(result.exit_code, 0)
with self.app.app_context(): with self.app.app_context():
accounts: list[BaseAccount] = BaseAccount.query.all() accounts: list[BaseAccount] = BaseAccount.query.all()
self.assertEqual(len(accounts), len(data)) self.assertEqual(len(accounts), len(data))
for account in accounts: for account in accounts:
self.assertIn(account.code, data) self.assertIn(account.code, data)