Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_export(self):
data = censusdata.download('acs5', 2015, censusdata.censusgeo([('state', '*')]), ['B01001_001E'])
try:
csv = StringIO.StringIO()
except NameError:
csv = io.StringIO()
censusdata.exportcsv(csv, data)
self.maxDiff = None
self.assertEqual(csv.getvalue(), textwrap.dedent("""\
state,NAME,B01001_001E
01,Alabama,4830620
02,Alaska,733375
04,Arizona,6641928
05,Arkansas,2958208
06,California,38421464
08,Colorado,5278906
09,Connecticut,3593222
10,Delaware,926454
11,District of Columbia,647484
12,Florida,19645772
13,Georgia,10006693
15,Hawaii,1406299
16,Idaho,1616547