gameMapTest.py 文件源码

python
阅读 36 收藏 0 点赞 0 评论 0

项目:clyde 作者: laurakah 项目源码 文件源码
def testWriteMapFile_writesStringIntoFile(self):
        dirname = "testWriteMapFile"
        filename = "test.txt"
        filepath = os.path.join(dirname, filename)
        os.mkdir(dirname)
        mObj = gameMap.GameMap()
        mObj.loadMapFile("maps/test-room2-l-shape.txt")
        expected = mObj.toText()
        mObj.writeMapFile(filepath)
        actual = None
        if os.path.exists(filepath):
            actual = open(filepath, "r").read()
        try:
            self.assertEqual(expected, actual)
        finally:
            if os.path.exists(filepath):
                os.unlink(filepath)
            os.rmdir(dirname)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号