-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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 ResourceWarnings in tests #1660
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,7 +33,6 @@ | |
import multiprocessing | ||
import shutil | ||
import sys | ||
from contextlib import contextmanager | ||
import subprocess | ||
|
||
import numpy as np | ||
|
@@ -135,7 +134,6 @@ def __exit__(self, type, value, traceback): | |
nocm = NoCM() | ||
|
||
|
||
@contextmanager | ||
def file_or_filename(input): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As I see in usage, this function used as contextmanager, why you remove this ( There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh, it really doesn't work as was expected, nice catch! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. After meged comment: Actually, it was already brokenl. Compare with code:
This code prints:
But expected something like:
Back to the |
||
""" | ||
Return a file-like object ready to be read from the beginning. `input` is either | ||
|
@@ -144,11 +142,11 @@ def file_or_filename(input): | |
""" | ||
if isinstance(input, string_types): | ||
# input was a filename: open as file | ||
yield smart_open(input) | ||
return smart_open(input) | ||
else: | ||
# input already a file-like object; just reset to the beginning | ||
input.seek(0) | ||
yield input | ||
return input | ||
|
||
|
||
def deaccent(text): | ||
|
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 you add a test for this?
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.
Hmm, ok. But I don't understand what exactly should I check in it ?
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 read full method definition, now it's clear for me, thanks.