def test_exc(self): ds = [{ "exchanges": [ { "categories": ("resource", "in ground"), "type": "biosphere", }, { "categories": ("resource", "all around"), "type": "biosphere" }, ] }] expected = [{ "exchanges": [ { "categories": [u"natural resource", u"in ground"], "type": "biosphere", }, { "categories": ("resource", "all around"), "type": "biosphere" }, ] }] self.assertEqual(expected, normalize_biosphere_categories(ds))
def test_exc(self): ds = [{ 'exchanges': [ { 'categories': ('resource', 'in ground'), 'type': 'biosphere', }, { 'categories': ('resource', 'all around'), 'type': 'biosphere' } ] }] expected = [{ 'exchanges': [ { 'categories': [u'natural resource', u'in ground'], 'type': 'biosphere', }, { 'categories': ('resource', 'all around'), 'type': 'biosphere' } ] }] self.assertEqual( expected, normalize_biosphere_categories(ds) )
def test_exc_no_categories(self): ds = [{ 'exchanges': [{'name': 'foo'}] }] self.assertEqual( ds, normalize_biosphere_categories(copy.deepcopy(ds)) )
def test_ds_wrong_type(self): ds = [{ 'categories': ('resource', 'in ground'), 'type': 'process' }] self.assertEqual( ds, normalize_biosphere_categories(copy.deepcopy(ds)) )
def test_ds(self): ds = [ {"categories": ("resource", "in ground"), "type": "emission"}, {"categories": ("resource", "all around"), "type": "emission"}, ] expected = [ {"categories": [u"natural resource", u"in ground"], "type": "emission"}, {"categories": ("resource", "all around"), "type": "emission"}, ] self.assertEqual(expected, normalize_biosphere_categories(ds))
def test_ds(self): ds = [{ 'categories': ('resource', 'in ground'), 'type': 'emission' }, { 'categories': ('resource', 'all around'), 'type': 'emission' }] expected = [{ 'categories': [u'natural resource', u'in ground'], 'type': 'emission' }, { 'categories': ('resource', 'all around'), 'type': 'emission' }] self.assertEqual(expected, normalize_biosphere_categories(ds))
def test_exc_no_categories(self): ds = [{"exchanges": [{"name": "foo"}]}] self.assertEqual(ds, normalize_biosphere_categories(copy.deepcopy(ds)))
def test_ds_wrong_type(self): ds = [{"categories": ("resource", "in ground"), "type": "process"}] self.assertEqual(ds, normalize_biosphere_categories(copy.deepcopy(ds)))