X-Git-Url: http://gitweb.michael.orlitzky.com/?a=blobdiff_plain;f=src%2FTests%2FUnit%2FSummaryFile1Test.py;h=18825dde9c10d3ced05cade2364173948c70d0b2;hb=951edca6362e1bb5988db751b908de8fdc946d1e;hp=edaf59859d91e1e89a5026ee959d1b4b38a87c6a;hpb=001156acd12c94e565a1c7f27d52a2f20dd1b516;p=dead%2Fcensus-tools.git diff --git a/src/Tests/Unit/SummaryFile1Test.py b/src/Tests/Unit/SummaryFile1Test.py index edaf598..18825dd 100644 --- a/src/Tests/Unit/SummaryFile1Test.py +++ b/src/Tests/Unit/SummaryFile1Test.py @@ -1,9 +1,18 @@ -import Tests.Fixtures, SummaryFile1, GPS, unittest +import unittest + +import Tests.Fixtures +import SummaryFile1 +import GPS +import StringUtils class BlockTest(unittest.TestCase): - def testAverageDensityIsFloat(self): + def setUp(self): + self.grp = SummaryFile1.GeoRecordParser() + + + def testOneAverageDensityIsFloat(self): """ We want to make sure no float->integer truncation is taking place. @@ -28,7 +37,22 @@ class BlockTest(unittest.TestCase): # intepreted as a float. self.assertEqual(b.population_density(), 1.25) - + + + def testAllAverageDensitiesAreFloat(self): + """ + Test every GeoRecord in the Maryland file, and make sure + all of the average densities can be parsed as floats. + """ + + fixture_path = Tests.Fixtures.Path() + '/SummaryFile1/mdgeo.uf1' + blocks = self.grp.parse_blocks(fixture_path) + + for b in blocks: + self.assertTrue(StringUtils.is_float(b.population_density())) + + + class GeoRecordParserTest(unittest.TestCase): def setUp(self):