summaryrefslogtreecommitdiff
path: root/contrib/py-bindings/test.py
diff options
context:
space:
mode:
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()