Skip to content

Commit

Permalink
Added additional field mapping tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
cgroskopf committed Jun 15, 2011
1 parent c9ff7fc commit 3accf18
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
3 changes: 3 additions & 0 deletions dataprocessing/crosswalk.py
Expand Up @@ -124,6 +124,9 @@
for key_2010 in keys_2010:
table_2010 = utils.parse_table_from_key(key_2010)

if k[-3:] != key_2010[-3:] and table != table_2010:
print k, key_2010, table, table_2010

if table_2010 not in data:
data[table_2010] = {}

Expand Down
14 changes: 12 additions & 2 deletions dataprocessing/tests_sf.py
Expand Up @@ -270,9 +270,19 @@ def test_different_tables(self):
self.assertEqual(float(state['data']['delta']['P3']['P003006']), delta)
self.assertAlmostEqual(float(state['data']['pct_change']['P3']['P003006']), pct_change)

@unittest.skip('TODO')
def test_different_everything(self):
pass
state = self.geographies.find_one({ 'geoid': '15' })

unmarried_partner_households_2000 = 23516
unmarried_partner_households_2010 = 33068
delta = unmarried_partner_households_2010 - unmarried_partner_households_2000
pct_change = float(unmarried_partner_households_2010 - unmarried_partner_households_2000) / unmarried_partner_households_2000

# 2000 field PCT014002
self.assertEqual(float(state['data']['2000']['PCT15']['PCT015013']), unmarried_partner_households_2000)
self.assertEqual(float(state['data']['2010']['PCT15']['PCT015013']), unmarried_partner_households_2010)
self.assertEqual(float(state['data']['delta']['PCT15']['PCT015013']), delta)
self.assertAlmostEqual(float(state['data']['pct_change']['PCT15']['PCT015013']), pct_change)

class TestLabels(unittest.TestCase):
def setUp(self):
Expand Down

0 comments on commit 3accf18

Please sign in to comment.