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 maybe copy tests #980
Add maybe copy tests #980
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.
Very nice tests! :) Just minor suggestions...
tests/test_core.py
Outdated
assert (df['col3'].dtypes == 'int64') | ||
|
||
def _write_file(name): |
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.
These can be put on one line.
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.
I tried this initially but was getting errors. Googled for this and seems you can skip one line feed, but not two.
The clean_up function is going away thx to TemporaryDirectory - let me see what I can do about the _write_file one.
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.
this looks nicer :)
def _write_file(dn, name): f = open(f'{dn}/{name}', 'w'); f.write(str(name)); f.close()
tests/test_core.py
Outdated
|
||
def test_copies_if_older(self): | ||
_write_file('first') |
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.
Probably best to use the tempfile
std lib and a with
block to ensure that the files are created somewhere appropriate, and automatically cleaned up when done.
Rebased on master and started to squash commits out of habit - hoping changing history did not mess anything up with the workflow on github. |
Great job! |
To get my feet wet with pytest, picked something relatively straight forward from
fastai.core
. Fixed a couple of typos along the way and made minor change tomaybe_copy
.Will start a thread to discuss.