From 78236905e82741eed253b91f437e84388a17f983 Mon Sep 17 00:00:00 2001 From: James Turk Date: Thu, 23 Apr 2015 00:41:31 -0400 Subject: [PATCH] pass encoding on py3 --- jellyfish/test.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/jellyfish/test.py b/jellyfish/test.py index adbdc86..1f26aa6 100644 --- a/jellyfish/test.py +++ b/jellyfish/test.py @@ -2,10 +2,11 @@ import sys if sys.version_info[0] < 3: import unicodecsv as csv + open_kwargs = {} else: import csv + open_kwargs = {'encoding': 'utf8'} import platform -import codecs import pytest @@ -29,7 +30,7 @@ def jf(request): def _load_data(name): - with codecs.open('testdata/{}.csv'.format(name), encoding='utf8') as f: + with open('testdata/{}.csv'.format(name), **open_kwargs) as f: for data in csv.reader(f): yield data @@ -96,7 +97,7 @@ def test_match_rating_comparison(jf, s1, s2, value): # assert jf.porter_stem(a) == b def test_porter_stem(jf): - with codecs.open('testdata/porter.csv', encoding='utf8') as f: + with open('testdata/porter.csv', **open_kwargs) as f: reader = csv.reader(f) for (a, b) in reader: assert jf.porter_stem(a) == b