def test_can_mix_multiple_substances_in_my_alembic(): alembic = Alembic() substance = [Substance() for _ in range(3)] alembic.mix(*substance) substance = [Substance() for _ in range(6)] alembic.mix(*substance)
def test_can_cook_and_ferment_substance(): substance = Substance() result = substance.cook() result = result.ferment() assert substance.state == ['cooked', 'fermented']
def pantry(): pantry = ListPantry() substance = Substance(nature='Sludge') pantry.add_substance(substance) substance = Substance(nature='Sulphur') pantry.add_substance(substance) return pantry
def test_mixing_sulphur_salt_and_mercury_gives_gloop(): alembic = Alembic() sulphur = Substance(nature='Sulphur') salt = Substance(nature='Salt') mercury = Substance(nature='Mercury') result = alembic.mix(sulphur, salt, mercury) assert result.nature == 'Gloop' result = alembic.mix(mercury, sulphur, salt) assert result.nature == 'Gloop'
def test_can_process_substance(): alembic = Alembic() substance = Substance() result = alembic.process('cook', substance) substance = Substance() cooked_substance = substance.cook() assert result.state == cooked_substance.state result = alembic.process('ferment', substance) cooked_fermented_substance = cooked_substance.ferment() assert result.state == cooked_fermented_substance.state
def test_cannot_perform_unknown_process(): alembic = Alembic() substance = Substance() with pytest.raises(UnknownProcessException): alembic.process('boil', substance)
def test_can_add_to_pantry(pantry_type, pantries): pantry = pantries[pantry_type] substance = Substance() pantry.add_substance(substance) assert pantry.count_all_substances() == 1
def test_can_add_to_pantry(): pantry = Pantry() substance = Substance() pantry.add_substance(substance) assert pantry.count_all_substances() == 1
def test_can_retrieve_substance_from_pantry_by_nature(pantry_type, pantries): pantry = pantries[pantry_type] substance = Substance(nature='Mercury') pantry.add_substance(substance) mercury = pantry.find_substances_by_nature('Mercury')[0] assert mercury.nature == 'Mercury'
def test_mixing_other_recipes_gives_sludge(): alembic = Alembic() sulphur = Substance(nature='Sulphur') salt = Substance(nature='Salt') mercury = Substance(nature='Mercury') gloop = Substance(nature='Gloop') result = alembic.mix(sulphur, salt, mercury, sulphur) assert result.nature == 'Sludge' result = alembic.mix(salt, mercury) assert result.nature == 'Sludge' result = alembic.mix(gloop, salt, mercury) assert result.nature == 'Sludge'
def test_the_order_of_processes_applied_to_a_substance_matters(): substance1 = Substance() result1 = substance1.cook() result1 = result1.ferment() substance2 = Substance() result2 = substance2.ferment() result2 = result2.cook() assert result1.state != result2.state assert result1.state == result2.state[::-1]
def test_can_cook_substance(): substance = Substance() result = substance.cook() assert substance.state == ['cooked']
def test_can_ferment_substance(): substance = Substance() result = substance.ferment() assert substance.state == ['fermented']
def test_can_pickle_substance(): substance = Substance() result = substance.pickle() assert result.state == ['pickled']
def test_can_wash_substance(): substance = Substance() result = substance.wash() assert result.state == ['washed']
def test_cannot_mix_one_substance_in_my_alembic(): alembic = Alembic() substance = Substance() with pytest.raises(NotEnoughSubstancesToMixException): alembic.mix(substance)