From 00c8bef0ff21794e622b7f442408e29c644b7002 Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Sat, 9 Jun 2012 15:08:51 +1200 Subject: Port test suite over to Nose. --- test/test_rparse.py | 64 ++++++++++++++++++++++------------------------------- 1 file changed, 27 insertions(+), 37 deletions(-) (limited to 'test/test_rparse.py') diff --git a/test/test_rparse.py b/test/test_rparse.py index a2a83c61..f0db75fd 100644 --- a/test/test_rparse.py +++ b/test/test_rparse.py @@ -1,11 +1,11 @@ import os -import libpry from libpathod import rparse, utils +import tutils rparse.TESTING = True -class uMisc(libpry.AutoTree): +class TestMisc: def test_generators(self): v = rparse.Value.parseString("'val'")[0] g = v.get_generator({}) @@ -26,16 +26,16 @@ class uMisc(libpry.AutoTree): assert g[1] == "n" def test_filegenerator(self): - t = self.tmpdir() - path = os.path.join(t, "foo") - f = open(path, "w") - f.write("x"*10000) - f.close() - g = rparse.FileGenerator(path) - assert len(g) == 10000 - assert g[0] == "x" - assert g[-1] == "x" - assert g[0:5] == "xxxxx" + with tutils.tmpdir() as t: + path = os.path.join(t, "foo") + f = open(path, "w") + f.write("x"*10000) + f.close() + g = rparse.FileGenerator(path) + assert len(g) == 10000 + assert g[0] == "x" + assert g[-1] == "x" + assert g[0:5] == "xxxxx" def test_valueliteral(self): v = rparse.ValueLiteral("foo") @@ -50,17 +50,17 @@ class uMisc(libpry.AutoTree): v = rparse.Value.parseString("