def test_transform(self): for name, t in concepts.NAME_TYPES.iteritems(): value = "1.0" tvalue = concepts.transform(name, value) if t == str: self.assertEqual(value, concepts.transform(name, value)) elif t == float: self.assertEqual(float(value), concepts.transform(name, value)) elif t == int: self.assertEqual(int(float(value)), concepts.transform(name, value))
def _get_rec(self, row): rec = {} for name,value in row.iteritems(): full_name = concepts.get_full_name(name) if not full_name: # Skip non-dwc names continue typed_value = concepts.transform(full_name, value) if typed_value: value = typed_value else: pass # TODO: Candidate for validation? rec[full_name] = value return rec