]> gitweb.michael.orlitzky.com - dead/census-tools.git/commitdiff
Added an additional Block class test which checks that all Maryland Geo Blocks have...
authorMichael Orlitzky <michael@orlitzky.com>
Sat, 12 Sep 2009 15:05:46 +0000 (11:05 -0400)
committerMichael Orlitzky <michael@orlitzky.com>
Sat, 12 Sep 2009 15:05:46 +0000 (11:05 -0400)
src/Tests/Unit/SummaryFile1Test.py

index edaf59859d91e1e89a5026ee959d1b4b38a87c6a..18825dde9c10d3ced05cade2364173948c70d0b2 100644 (file)
@@ -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):