Skip to content

Commit

Permalink
rename name file to infile in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
horpto committed Oct 30, 2017
1 parent a8bfb63 commit c3c8314
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions smart_open/tests/test_smart_open.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@ def test_http_pass(self):
def test_http_gz(self):
"""Can open gzip via http?"""
fpath = os.path.join(CURR_DIR, 'test_data/crlf_at_1k_boundary.warc.gz')
with open(fpath, 'rb') as file:
data = file.read()
with open(fpath, 'rb') as infile:
data = infile.read()

responses.add(responses.GET, "http://127.0.0.1/data.gz",
body=data)
Expand All @@ -147,8 +147,8 @@ def test_http_gz(self):
def test_http_bz2(self):
"""Can open bz2 via http?"""
test_string = b'Hello World Compressed.'
with tempfile.NamedTemporaryFile('wb', suffix='.bz2', delete=False) as file:
test_file = file.name
with tempfile.NamedTemporaryFile('wb', suffix='.bz2', delete=False) as infile:
test_file = infile.name

with smart_open.smart_open(test_file, 'wb') as outfile:
outfile.write(test_string)
Expand Down Expand Up @@ -787,22 +787,22 @@ def write_read_assertion(self, test_file):
def test_open_gz(self):
"""Can open gzip?"""
fpath = os.path.join(CURR_DIR, 'test_data/crlf_at_1k_boundary.warc.gz')
with smart_open.smart_open(fpath) as file:
data = file.read()
with smart_open.smart_open(fpath) as infile:
data = infile.read()
m = hashlib.md5(data)
assert m.hexdigest() == '18473e60f8c7c98d29d65bf805736a0d', \
'Failed to read gzip'

def test_write_read_gz(self):
"""Can write and read gzip?"""
with tempfile.NamedTemporaryFile('wb', suffix='.gz', delete=False) as file:
test_file_name = file.name
with tempfile.NamedTemporaryFile('wb', suffix='.gz', delete=False) as infile:
test_file_name = infile.name
self.write_read_assertion(test_file_name)

def test_write_read_bz2(self):
"""Can write and read bz2?"""
with tempfile.NamedTemporaryFile('wb', suffix='.bz2', delete=False) as file:
test_file_name = file.name
with tempfile.NamedTemporaryFile('wb', suffix='.bz2', delete=False) as infile:
test_file_name = infile.name
self.write_read_assertion(test_file_name)


Expand Down

0 comments on commit c3c8314

Please sign in to comment.