summaryrefslogtreecommitdiff
path: root/contrib/py-bindings/test.py
diff options
context:
space:
mode:
authorjordi.saludes <jordi.saludes@upc.edu>2010-07-27 15:42:48 +0000
committerjordi.saludes <jordi.saludes@upc.edu>2010-07-27 15:42:48 +0000
commitdcac7254f3fc24cde44af516374b0b3ce3881481 (patch)
treec2e3f2cc6b702d38844e9b1529d6c75d2f51fa1c /contrib/py-bindings/test.py
parentb9de5c36c0a62048abee457d89b994ebbeb7acf7 (diff)
Added 'functions' and 'functionType' to py-bindings.
Diffstat (limited to 'contrib/py-bindings/test.py')
-rw-r--r--contrib/py-bindings/test.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/contrib/py-bindings/test.py b/contrib/py-bindings/test.py
index 04adb2c29..8b1bc9443 100644
--- a/contrib/py-bindings/test.py
+++ b/contrib/py-bindings/test.py
@@ -72,7 +72,16 @@ class TestPgfInfo(unittest.TestCase):
for lang in 'QueryEng QuerySpa'.split():
l = gf.read_language(lang)
self.assertEqual(rmprefix(l),lang)
-
+ def test_functions(self):
+ pgf = self.pgf()
+ self.assertTrue('Even' in [`f` for f in pgf.functions()])
+ def test_function_types(self):
+ pgf = self.pgf()
+ gftypes = dict((`f`,`pgf.fun_type(f)`) for f in pgf.functions())
+ for p in "Prime : Object -> Question; Yes : Answer".split(';'):
+ lhs,rhs = [s.strip() for s in p.split(':')]
+ self.assertEqual(gftypes[lhs],rhs)
+
class TestParsing(unittest.TestCase):
def setUp(self):
self.lexed = samples
@@ -154,5 +163,6 @@ class TestUnapplyExpr(unittest.TestCase):
if type(uexp) != type(2) and type(uexp) != type('2'):
exp = uexp[1]
+
if __name__ == '__main__':
unittest.main()