3 ms·
>assert db_session.query(User).count() == 1 >assert db_session.query(User).get(user.user_id) is not None These aren't testing the same thing. Wind database cl
by charcircuit 5y ago
>assert db_session.query(User).count() == 1
>assert db_session.query(User).get(user.user_id) is not None
These aren't testing the same thing. Wind database clearing you are observing count going from 0 to 1, but without clearing the database you way still pass if it goes from 1 to 1 instead of 1 to 2.
If you don't clear your database your database state will be considered an input to the test and it may be needed to reproduce a test.