-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.
# 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):