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

BUG - when the object is accessed (type-cast) affects the patch #141

Open
shobnaren opened this issue May 24, 2020 · 1 comment
Open

BUG - when the object is accessed (type-cast) affects the patch #141

shobnaren opened this issue May 24, 2020 · 1 comment

Comments

@shobnaren
Copy link

print(list(result)) ## typecast change causes the breakage
patched = patch(result,first)
assert patched == second

This fails when there is print(list(result)) but works fine when there is no print/type-cast involved.

@holvi-mikael
Copy link

result is a generator, which you exhaust when feeding it to the list (list() is a regular constructor, not "typecasting", which does not really exist in Python outside low-level C interop).
If you want to view the result via list before using it, store the resulting list and use that instead when patching.

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

No branches or pull requests

2 participants