From 2c8f17eae7b23b7c252bead15ba9bf043f03e8d2 Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Sat, 28 Apr 2012 13:16:51 +1200 Subject: First pass at static file serving. --- test/test_rparse.py | 39 +++++++++++++++++++++++++++++++++------ 1 file changed, 33 insertions(+), 6 deletions(-) (limited to 'test/test_rparse.py') diff --git a/test/test_rparse.py b/test/test_rparse.py index b872b1f3..0ee3aae4 100644 --- a/test/test_rparse.py +++ b/test/test_rparse.py @@ -1,4 +1,4 @@ -import StringIO, sys +import StringIO, sys, os import libpry from libpathod import rparse @@ -24,11 +24,43 @@ class uMisc(libpry.AutoTree): assert g[:] == "one" 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" + def test_valueliteral(self): v = rparse.ValueLiteral("foo") assert v.expr() assert str(v) + def test_file_value(self): + v = rparse.Value.parseString("<'one two'")[0] + assert v.path == "one two" + + v = rparse.Value.parseString("