Skip to content

Commit b91032a

Browse files
committed
fix broken test
1 parent ae59c67 commit b91032a

File tree

1 file changed

+20
-8
lines changed

1 file changed

+20
-8
lines changed

tests/test_bug_fixes.py

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,29 @@
11
# -*- coding: utf-8 -*-
22
import os
3+
import sys
34
from common import TestExtendedInput
45
from nose.tools import eq_
56

67

8+
PY2 = sys.version_info[0] == 2
9+
10+
711
def test_issue_4():
812
myinput = TestExtendedInput()
913
fixture = os.path.join("tests", "fixtures", "issue4-broken.csv")
10-
with open(fixture, "r") as f:
11-
array = myinput.get_array(field_name=('csv', f), encoding='latin1')
12-
expected = [
13-
[u'Last Name', u'First Name', u'Company', u'Email', u'Job Title'],
14-
[u'Test', u'Th\xefs', u'Cool Co',
15-
u'test.this@example.com', u'Founder']
16-
]
17-
eq_(array, expected)
14+
15+
expected = [
16+
[u'Last Name', u'First Name', u'Company', u'Email', u'Job Title'],
17+
[u'Test', u'Th\xefs', u'Cool Co',
18+
u'test.this@example.com', u'Founder']
19+
]
20+
if PY2:
21+
with open(fixture, "rb") as f:
22+
array = myinput.get_array(field_name=('csv', f),
23+
encoding='latin1')
24+
eq_(array, expected)
25+
else:
26+
with open(fixture, "r", encoding='latin1') as f:
27+
array = myinput.get_array(field_name=('csv', f))
28+
eq_(array, expected)
29+

0 commit comments

Comments
 (0)