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)
评论列表
文章目录