diff options
Diffstat (limited to 'test/sql')
| -rw-r--r-- | test/sql/test_functions.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/test/sql/test_functions.py b/test/sql/test_functions.py index 43b505c99..f3fb724c0 100644 --- a/test/sql/test_functions.py +++ b/test/sql/test_functions.py @@ -542,6 +542,31 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL): "row_number() OVER ()", ) + def test_pickle_within_group(self): + """test #6520""" + + # TODO: the test/sql package lacks a comprehensive pickling + # test suite even though there are __reduce__ methods in several + # places in sql/elements.py. likely as part of + # test/sql/test_compare.py might be a place this can happen but + # this still relies upon a strategy for table metadata as we have + # in serializer. + + f1 = func.percentile_cont(literal(1)).within_group() + + self.assert_compile( + util.pickle.loads(util.pickle.dumps(f1)), + "percentile_cont(:param_1) WITHIN GROUP (ORDER BY )", + ) + + f1 = func.percentile_cont(literal(1)).within_group( + column("q"), column("p").desc() + ) + self.assert_compile( + util.pickle.loads(util.pickle.dumps(f1)), + "percentile_cont(:param_1) WITHIN GROUP (ORDER BY q, p DESC)", + ) + def test_functions_with_cols(self): users = table( "users", column("id"), column("name"), column("fullname") |
