Example #1
0
def test_group_renew():
    group = Group()

    u1 = Unit(1, 1)
    group.addUnit(u1)
    assert group.unitList == [u1]

    u2 = Unit(2, 2)
    group.renew([u2])
    assert group.unitList == [u2]
Example #2
0
def test_group_add_units():
    group = Group()

    u1 = Unit(1, 1)
    u2 = Unit(2, 2)
    u3 = Unit(3, 3)

    group.addUnit(u1)
    group.addUnit(u2)
    group.addUnit(u3)

    assert group.unitList == [u1, u2, u3]
    assert group.getX() == 2 # mass X
    assert group.getY() == 2 # mass Y