def test_get_moment(self): chunk = Chunk() self.assertEquals(chunk.get_moment(), 0.0, "bad initial moment") shard1 = Disc(gold, 2, (10, 20)) shard2 = Block(gold, self.unitsquare, (100, 200)) chunk.shards = [shard1, shard2] expected = shard1.get_moment() + shard2.get_moment() self.assertEquals(chunk.get_moment(), expected, "bad moment")
def test_get_moment(self): radius = 5 offset = (1, 2) disc = Disc(gold, radius, offset) expected = moment_for_circle(disc.mass, 0, radius, offset) self.assertEquals(disc.get_moment(), expected, "bad moment")