Пример #1
0
def test_removing():
    # Tests removing a hull object from the ship
    spacecraft = Spacecraft(100)
    reflec = Option("Reflec")

    spacecraft.modify_hull_option(reflec)
    assert spacecraft.get_remaining_cargo() == 100
    assert spacecraft.get_total_cost() == 12.0
    assert len(spacecraft.hull_options) == 1

    new_reflec = Option("Reflec")
    spacecraft.modify_hull_option(new_reflec)
    assert spacecraft.get_remaining_cargo() == 100
    assert spacecraft.get_total_cost() == 2.0
    assert len(spacecraft.hull_options) == 0
Пример #2
0
def test_adding():
    # Tests adding hull objects to the ship
    spacecraft = Spacecraft(100)
    reflec = Option("Reflec")
    stealth = Option("Stealth")

    spacecraft.modify_hull_option(reflec)
    assert spacecraft.get_remaining_cargo() == 100
    assert spacecraft.get_total_cost() == 12.0
    assert len(spacecraft.hull_options) == 1

    spacecraft.modify_hull_option(stealth)
    assert spacecraft.get_remaining_cargo() == 100
    assert spacecraft.get_total_cost() == 22.0
    assert len(spacecraft.hull_options) == 2