def test_save(tmpdir): st = SymbolsTable() st.add("a", 1) st.add("b", 2) st_file = tmpdir / "syms" st.save(str(st_file)) assert st_file.read_text("utf-8") == "a 1\nb 2\n"
def test_save(self): st = SymbolsTable() st.add("a", 1) st.add("b", 2) table_file = NamedTemporaryFile(delete=False) st.save(table_file) with open(table_file.name, "r") as f: table_content = f.read() self.assertEqual(table_content, "a 1\nb 2\n") os.remove(table_file.name)