Skip to content

Commit

Permalink
add close after using stringio
Browse files Browse the repository at this point in the history
  • Loading branch information
GreatYYX committed Nov 21, 2018
1 parent e83474c commit 57ef371
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions rltk/tests/test_io_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ def test_dataframe_reader():

def test_csv_reader():
f = io.StringIO()

writer = csv.DictWriter(f, fieldnames=['1', '2'])
writer.writeheader()
for a in arr:
Expand All @@ -35,8 +36,11 @@ def test_csv_reader():

def test_jsonlines_reader():
f = io.StringIO()

for a in arr:
f.write(json.dumps(a) + '\n')

for idx, obj in enumerate(JsonLinesReader(f)):
assert obj == arr[idx]

f.close()

0 comments on commit 57ef371

Please sign in to comment.