class TestBravoProtocolChunks(TestCase): def setUp(self): self.bcp = BravoConfigParser() self.p = BravoProtocol(self.bcp, "unittest") self.p.setTimeout(None) self.p.state = STATE_LOCATED def test_trivial(self): pass def test_ascend_zero(self): """ ``ascend()`` can take a count of zero to ensure that the client is standing on solid ground. """ self.p.location.pos = self.p.location.pos._replace(y=16) c = Chunk(0, 0) c.set_block((0, 0, 0), 1) self.p.chunks[0, 0] = c self.p.ascend(0) self.assertEqual(self.p.location.pos.y, 16) def test_ascend_zero_up(self): """ Even with a zero count, ``ascend()`` will move the player to the correct elevation. """ self.p.location.pos = self.p.location.pos._replace(y=16) c = Chunk(0, 0) c.set_block((0, 0, 0), 1) c.set_block((0, 1, 0), 1) self.p.chunks[0, 0] = c self.p.ascend(0) self.assertEqual(self.p.location.pos.y, 32) def test_ascend_one_up(self): """ ``ascend()`` moves players upwards. """ self.p.location.pos = self.p.location.pos._replace(y=16) c = Chunk(0, 0) c.set_block((0, 0, 0), 1) c.set_block((0, 1, 0), 1) self.p.chunks[0, 0] = c self.p.ascend(1) self.assertEqual(self.p.location.pos.y, 32)
class TestBravoProtocolChunks(TestCase): def setUp(self): self.bcp = BravoConfigParser() self.p = BravoProtocol(self.bcp, "unittest") self.p.setTimeout(None) self.p.state = STATE_LOCATED def test_trivial(self): pass def test_ascend_zero(self): """ ``ascend()`` can take a count of zero to ensure that the client is standing on solid ground. """ self.p.location.pos = self.p.location.pos._replace(y=16) c = Chunk(0, 0) c.set_block((0, 0, 0), 1) self.p.chunks[0, 0] = c self.p.ascend(0) self.assertEqual(self.p.location.pos.y, 16) def test_ascend_zero_up(self): """ Even with a zero count, ``ascend()`` will move the player to the correct elevation. """ self.p.location.pos = self.p.location.pos._replace(y=16) c = Chunk(0, 0) c.set_block((0, 0, 0), 1) c.set_block((0, 1, 0), 1) self.p.chunks[0, 0] = c self.p.ascend(0) self.assertEqual(self.p.location.pos.y, 32) def test_ascend_one_up(self): """ ``ascend()`` moves players upwards. """ self.p.location.pos = self.p.location.pos._replace(y=16) c = Chunk(0, 0) c.set_block((0, 0, 0), 1) c.set_block((0, 1, 0), 1) self.p.chunks[0, 0] = c self.p.ascend(1) self.assertEqual(self.p.location.pos.y, 32)