From b0e0bbb816b578910d0e08f034a732fc5fc898fd Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Sun, 26 Aug 2012 11:30:42 -0400 Subject: - tweak the GenericFunction constructor more so that it's action in parsing the arguments is easier to understand - add a test to ensure generic function can have a custom name --- test/sql/test_functions.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'test/sql/test_functions.py') diff --git a/test/sql/test_functions.py b/test/sql/test_functions.py index b69f8f6ba..fc227f375 100644 --- a/test/sql/test_functions.py +++ b/test/sql/test_functions.py @@ -114,6 +114,19 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL): assert isinstance(func.mypackage.myfunc(), f1) assert isinstance(func.myotherpackage.myfunc(), f2) + def test_custom_name(self): + class MyFunction(GenericFunction): + name = 'my_func' + + def __init__(self, *args): + args = args + (3,) + super(MyFunction, self).__init__(*args) + + self.assert_compile( + func.my_func(1, 2), + "my_func(:param_1, :param_2, :param_3)" + ) + def test_custom_args(self): class myfunc(GenericFunction): pass -- cgit v1.2.1