Skip to content

Commit

Permalink
Read whole file for completeness. Include an example of how to use cs…
Browse files Browse the repository at this point in the history
…v.reader to parse the incoming export
  • Loading branch information
paulmakepeace committed Jul 20, 2011
1 parent e6a2810 commit 2b8456b
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/test_refine.py
Expand Up @@ -9,6 +9,7 @@

# Copyright (c) 2011 Paul Makepeace, Real Programmers. All rights reserved.

import csv
import unittest

from google.refine import refine
Expand Down Expand Up @@ -61,6 +62,17 @@ def test_open_export(self):
fp = refine.RefineProject(self.project.project_url()).export()
line = fp.next()
self.assertTrue('email' in line)
for line in fp:
self.assertTrue('M' in line or 'F' in line)
fp.close()

def test_open_export_csv(self):
fp = refine.RefineProject(self.project.project_url()).export()
csv_fp = csv.reader(fp, dialect='excel-tab')
row = csv_fp.next()
self.assertTrue(row[0] == 'email')
for row in csv_fp:
self.assertTrue(row[3] == 'F' or row[3] == 'M')
fp.close()


Expand Down

0 comments on commit 2b8456b

Please sign in to comment.