Esempio n. 1
0
def test_can_advance_TrapSeed_along_a_heading_and_loses_lifespan(
        heading, column):
    # Rather than patch heading_to_delta in TrapSeed.advance we just
    # assert that the effect of advancing the TrapSeed matches that
    # defined by heading_to_delta

    expected_dx, expected_dy = heading_to_delta(heading, is_even(column))

    trapSeed = TrapSeed(column, 5, heading, 10)
    assert trapSeed.advance() == TrapSeed(column + expected_dx,
                                          5 + expected_dy, heading, 9)

    # Original instance is not actually changed
    assert trapSeed == TrapSeed(column, 5, heading, 10)
Esempio n. 2
0
def test_can_reverse_a_TrapSeed_along_a_heading_and_loses_lifespan():
    trapSeed = TrapSeed(5, 5, 0, 10)
    assert trapSeed.advance(reverse=True) == TrapSeed(5, 4, 180, 9)

    # Original instance is not actually changed
    assert trapSeed == TrapSeed(5, 5, 0, 10)