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_unknown_tabletype(self):
self.assertRaises(ValueError, censusdata.censusvar, 'acs5', 2015, ['B19013_001E', 'D19013_002E'])
self.assertRaises(ValueError, censusdata.censustable, 'acs5', 2015, 'C19013')
self.assertRaises(ValueError, censusdata.search, 'acs5', 2015, 'concept', 'unweighted sample', tabletype='cdetail')
def test_search(self):
self.assertEqual(censusdata.search('acs5', 2015, 'concept', 'unweighted sample'), [
('B00001_001E', 'B00001. Unweighted Sample Count of the Population', 'Total'),
('B00001_001M', 'B00001. Unweighted Sample Count of the Population', 'Margin Of Error For!!Total'),
('B00002_001E', 'B00002. Unweighted Sample Housing Units', 'Total'),
('B00002_001M', 'B00002. Unweighted Sample Housing Units', 'Margin Of Error For!!Total'),
])
s = censusdata.search('acs5', 2018, 'concept', 'SEX BY AGE')
self.assertEqual(len(s), 2969)
self.assertEqual(s[0], ('B01001A_001E', 'SEX BY AGE (WHITE ALONE)', 'Estimate!!Total'))
def test_search(self):
self.assertEqual(censusdata.search('acs5', 2015, 'concept', 'unweighted sample'), [
('B00001_001E', 'B00001. Unweighted Sample Count of the Population', 'Total'),
('B00001_001M', 'B00001. Unweighted Sample Count of the Population', 'Margin Of Error For!!Total'),
('B00002_001E', 'B00002. Unweighted Sample Housing Units', 'Total'),
('B00002_001M', 'B00002. Unweighted Sample Housing Units', 'Margin Of Error For!!Total'),
])
s = censusdata.search('acs5', 2018, 'concept', 'SEX BY AGE')
self.assertEqual(len(s), 2969)
self.assertEqual(s[0], ('B01001A_001E', 'SEX BY AGE (WHITE ALONE)', 'Estimate!!Total'))