def test_no_key_value_pairs_location(self): result = get_transactions(self.location3) self.assertEqual(len(result), 1) self.assertEqual(result[0].get('agencyCode'), 'USGS ') self.assertEqual(result[0].get('siteNumber'), '580042108433301') self.assertEqual(result[0].get('key_value_pairs'), '') self.assertEqual(result[0].get('line_numbers'), [2])
def test_single_location(self): result = get_transactions(self.location1) self.assertEqual(len(result), 1) self.assertEqual(result[0].get('agencyCode'), 'USGS ') self.assertEqual(result[0].get('siteNumber'), '480042108433301') self.assertEqual(result[0].get('key_value_pairs'), ('R=0* T=A* 12=\'YELLVILLE WATERWORKS\'* 11=S* 35=M* 36=NAD27* ' '6=05* 7=05* 8=089* 20=11010003* 802=NNNNNNNNNNNNYNNNNNNN* ' '39=WS* 813=CST* 814=Y* 3=C* 41=US*') ), self.assertEqual(result[0].get('line_numbers'), [2, 3, 4])
def test_two_locations(self): result = get_transactions(self.location1 + self.location2) self.assertEqual(len(result), 2) self.assertEqual(result[0].get('agencyCode'), 'USGS ') self.assertEqual(result[0].get('siteNumber'), '480042108433301') self.assertEqual(result[0].get('key_value_pairs'), ('R=0* T=A* 12=\'YELLVILLE WATERWORKS\'* 11=S* 35=M* 36=NAD27* ' '6=05* 7=05* 8=089* 20=11010003* 802=NNNNNNNNNNNNYNNNNNNN* ' '39=WS* 813=CST* 814=Y* 3=C* 41=US*') ) self.assertEqual(result[0].get('line_numbers'), [2, 3, 4]) self.assertEqual(result[1].get('agencyCode'), 'USEPA') self.assertEqual(result[1].get('siteNumber'), '123456789012345') self.assertEqual(result[1].get('key_value_pairs'), ('R=0* T=A* 12=\'INTAKE ON LAKE WOBEGON\'* 802=FA-DV ' 'Long Line S* 35=M* 36=NAD27* 6=05* 7=05* 8=023* 20=11010014*') ) self.assertEqual(result[1].get('line_numbers'), [5, 6])
def test_no_locations(self): self.assertEqual(get_transactions([]), [])