Ejemplo n.º 1
0
def test_removing():
    # Tests removing a screen object from the ship
    ship = Spacecraft(200)
    assert ship.get_remaining_cargo() == 200
    assert ship.get_total_cost() == 8.0

    damper = Screen("Nuclear Damper")
    ship.modify_screen(damper)
    assert ship.get_remaining_cargo() == 150
    assert ship.get_total_cost() == 58.0

    new_damper = Screen("Nuclear Damper")
    ship.modify_screen(new_damper)
    assert ship.get_remaining_cargo() == 200
    assert ship.get_total_cost() == 8.0
Ejemplo n.º 2
0
def test_adding():
    # Tests adding each screen type
    damper = Screen("Nuclear Damper")
    meson = Screen("Meson Screen")
    extra = Screen("Nuclear Damper")

    ship = Spacecraft(200)
    assert ship.get_remaining_cargo() == 200
    assert ship.get_total_cost() == 8.0

    ship.modify_screen(damper)
    assert ship.get_remaining_cargo() == 150
    assert ship.get_total_cost() == 58.0

    ship.modify_screen(meson)
    assert ship.get_remaining_cargo() == 100
    assert ship.get_total_cost() == 118.0