Skip to content

Commit

Permalink
Lets try this
Browse files Browse the repository at this point in the history
  • Loading branch information
palewire committed Jul 19, 2017
1 parent 9d2968c commit 58fc005
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 15 deletions.
5 changes: 4 additions & 1 deletion censusbatchgeocoder/__init__.py
Expand Up @@ -147,7 +147,10 @@ def geocode(self, string_or_stream):
request_csv = list(agate.csv.DictReader(request_file, **self.agate_options))
elif isinstance(string_or_stream, six.string_types):
# This is for strings that should be a path leading to a file
request_file = open(string_or_stream, 'r')
if six.PY3 and self.encoding:
request_file = open(string_or_stream, 'r', encoding=self.encoding)
else:
request_file = open(string_or_stream, 'r')
request_csv = list(agate.csv.DictReader(request_file, **self.agate_options))
else:
# Otherwise we assume it's a list of dictionaries ready to go
Expand Down
28 changes: 14 additions & 14 deletions censusbatchgeocoder/tests/__init__.py
Expand Up @@ -87,17 +87,17 @@ def test_wide(self):
)
self.assertEqual(len(result), 10)

# def test_bom(self):
# result = censusbatchgeocoder.geocode(
# self.bom_path,
# id="Affidavit ID",
# address="Street",
# city="City",
# state="State",
# zipcode="Zip",
# encoding="utf-8-sig"
# )
# self.assertEqual(len(result), 4)
def test_bom(self):
result = censusbatchgeocoder.geocode(
self.bom_path,
id="Affidavit ID",
address="Street",
city="City",
state="State",
zipcode="Zip",
encoding="utf-8-sig"
)
self.assertEqual(len(result), 4)

def test_no_state_and_zipcode(self):
result = censusbatchgeocoder.geocode(self.incomplete_path, state=None, zipcode=None)
Expand All @@ -111,6 +111,6 @@ def test_batch_size(self):
result = censusbatchgeocoder.geocode(self.small_path, batch_size=2)
self.assertEqual(len(result), 5)

def test_big_batch(self):
result = censusbatchgeocoder.geocode(self.big_path)
self.assertEqual(len(result), 1498)
# def test_big_batch(self):
# result = censusbatchgeocoder.geocode(self.big_path)
# self.assertEqual(len(result), 1498)

0 comments on commit 58fc005

Please sign in to comment.