-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Fix unexpected loading after print
#1724
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch! In the long term, it would be nice to get ride of these uses of _data
, maybe by switching entirely from our lazy array classes to Dask.
xarray/tests/test_backends.py
Outdated
""" Make sure print does not load file into memory """ | ||
in_memory = create_test_data() | ||
with self.roundtrip(in_memory) as on_disk: | ||
if not on_disk['var1']._in_memory: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we write this without the conditional check? It's usually best to avoid control flow in tests -- it makes it more obvious what is going on.
xarray/tests/test_backends.py
Outdated
in_memory = create_test_data() | ||
with self.roundtrip(in_memory) as on_disk: | ||
if not on_disk['var1']._in_memory: | ||
print(on_disk) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just call repr(on_disk)
to avoid actually printing to stdout.
@shoyer
Maybe related to your previous comment in #1705? |
git diff upstream/master **/*py | flake8 --diff
whats-new.rst
for all changes andapi.rst
for new APIOnly a single missing underscore causes this issue :)
Added tests.