def test_example_1(elem: str, quantities: int, mined_ore: int,
                   store: Dict[str, int]):
    nano = NanoFactory.from_file('example_1.txt')
    nano.produce(elem, quantities, True)

    assert nano.mined_ore == mined_ore
    assert {k: v for k, v in nano.storage.items() if v > 0} == store
def test_mass_produce(filename: str, ore_per_fuel: int, fuel: int):
    nano = NanoFactory.from_file(filename)
    nano.storage = {
        'ORE': 1000000000000,
    }
    nano.mass_produce('FUEL', ore_per_fuel)
    assert nano.storage['FUEL'] == fuel, f'{nano.storage}'
def test_load_file():
    nano = NanoFactory.from_file('example_1.txt')

    exp_recipes = {
        'A': '10 ORE => 10 A',
        'B': '1 ORE => 1 B',
        'C': '7 A, 1 B => 1 C',
        'D': '7 A, 1 C => 1 D',
        'E': '7 A, 1 D => 1 E',
        'FUEL': '7 A, 1 E => 1 FUEL',
    }
    assert {k: str(v) for k, v in nano.recipes.items()} == exp_recipes
    assert nano.mined_ore == 0
def test_question_1():
    nano = NanoFactory.from_file('input.txt')
    nano.produce('FUEL', 1, True)
    assert nano.mined_ore == 654909
def test_example_2(filename: str, ore: int):
    nano = NanoFactory.from_file(filename)
    nano.produce('FUEL', 1, True)

    assert nano.mined_ore == ore
def test_question_2():  # Does not pass :(
    nano = NanoFactory.from_file('input.txt')
    nano.mass_produce('FUEL', 654909)
    assert nano.storage['FUEL'] == 2876992