Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add doctesting for new deletion in 0.2.1 versions #33

Open
rajivsarvepalli opened this issue Jan 19, 2021 · 1 comment
Open

Add doctesting for new deletion in 0.2.1 versions #33

rajivsarvepalli opened this issue Jan 19, 2021 · 1 comment
Labels
documentation Improvements or additions to documentation

Comments

@rajivsarvepalli
Copy link
Owner

Improve documentation to add information inside the docstring for UnifiedAlchemyMagicMock to include testing for adding keywords argument to delete with no impact.

You can use keywords with delete like so:

n_d = s.query(Data).filter(Data.data_p1 >= 13).delete(synchronize_session=False)

and this will work. However, the keyword arguments have no impact on the delete command, but merely are allowed so as little code as possible has to be changed. However, delete cannot be used with objects such as:

a = Data(pk1=11, data_p1=31.5, data_p2=67.1, name="test13")
n_d = s.delete(a)

The above code is invalid when using UnifiedAlchemyMagicMock as the session object s.

@rajivsarvepalli rajivsarvepalli added the documentation Improvements or additions to documentation label Jan 19, 2021
@luizdepra
Copy link

Could be possible to mock session.delete(entity)? I think it will always conflict with entity.delete().

For now, I'm overriding the default implementation by doing this (assume I'm using AsyncSession):

session.delete = mock.AsyncMock()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants