# HG changeset patch # User Tero Marttila # Date 1234804097 -7200 # Node ID a46d2fc07951925b080b9d1ca8a09598bba16956 # Parent bef7196f7682c4fd78cf9637f375f6eb0e8fe889 add test for tree_parse filesystem stuff diff -r bef7196f7682 -r a46d2fc07951 tests/test_treeparse.py --- a/tests/test_treeparse.py Mon Feb 16 19:02:59 2009 +0200 +++ b/tests/test_treeparse.py Mon Feb 16 19:08:17 2009 +0200 @@ -4,7 +4,7 @@ Unit tests for qmsk.web.tree_parse """ -import unittest +import unittest, os import tree_parse class TestTreeParse (unittest.TestCase) : @@ -76,3 +76,26 @@ # XXX: don't test root, as that's known-broken still +class TestTreeParseFS (unittest.TestCase) : + DATA = ["foo", " bar", " quux"] + def setUp (self) : + """ + Sets up a temporary file with the path in self.path, and self.DATA + """ + + # XXX: supress warnings + self.path = os.tempnam() + + # write out DATA + open(self.path, 'w').write('\n'.join(self.DATA)) + + def tearDown (self) : + """ + Removes the tempfile created earlier + """ + + os.remove(self.path) + + def test_simple (self) : + self.assertEquals(tree_parse.parse(self.path), (1, "foo", [(2, "bar", []), (3, "quux", [])])) +