예제 #1
0
    def test_redo_lcia_switches_demand(self):
        test_data = {
            ("t", "1"): {
                'exchanges': [{
                    'amount': 1,
                    'input': ('t', "2"),
                    'type': 'technosphere',
                }],
            },
            ("t", "2"): {
                'exchanges': [{
                    'amount': 1,
                    'input': ('biosphere', "1"),
                    'type': 'biosphere',
                }],
            },
        }
        method_data = [(('biosphere', "1"), 42)]
        self.add_basic_biosphere()
        test_db = Database("t")
        test_db.register()
        test_db.write(test_data)

        method = Method(("a method", ))
        method.register()
        method.write(method_data)

        lca = LCA({("t", "1"): 1}, ("a method", ))
        lca.lci()
        lca.lcia()
        self.assertEqual(lca.demand, {("t", "1"): 1})

        lca.redo_lcia({("t", "2"): 2})
        self.assertEqual(lca.demand, {("t", "2"): 2})
예제 #2
0
    def test_redo_lcia_switches_demand(self):
        test_data = {
            ("t", "1"): {
                "exchanges": [{
                    "amount": 1,
                    "input": ("t", "2"),
                    "type": "technosphere",
                }],
            },
            ("t", "2"): {
                "exchanges": [{
                    "amount": 1,
                    "input": ("biosphere", "1"),
                    "type": "biosphere",
                }],
            },
        }
        method_data = [(("biosphere", "1"), 42)]
        self.add_basic_biosphere()
        test_db = Database("t")
        test_db.register()
        test_db.write(test_data)

        method = Method(("a method", ))
        method.register()
        method.write(method_data)

        lca = LCA({("t", "1"): 1}, ("a method", ))
        lca.lci()
        lca.lcia()
        self.assertEqual(lca.demand, {("t", "1"): 1})

        lca.redo_lcia({("t", "2"): 2})
        self.assertEqual(lca.demand, {("t", "2"): 2})