MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_pickle_within_group

Method test_pickle_within_group

test/sql/test_functions.py:652–675  ·  view source on GitHub ↗

test #6520

(self)

Source from the content-addressed store, hash-verified

650 )
651
652 def test_pickle_within_group(self):
653 """test #6520"""
654
655 # TODO: the test/sql package lacks a comprehensive pickling
656 # test suite even though there are __reduce__ methods in several
657 # places in sql/elements.py. likely as part of
658 # test/sql/test_compare.py might be a place this can happen but
659 # this still relies upon a strategy for table metadata as we have
660 # in serializer.
661
662 f1 = func.percentile_cont(literal(1)).within_group(column("q"))
663
664 self.assert_compile(
665 pickle.loads(pickle.dumps(f1)),
666 "percentile_cont(:param_1) WITHIN GROUP (ORDER BY q)",
667 )
668
669 f1 = func.percentile_cont(literal(1)).within_group(
670 column("q"), column("p").desc()
671 )
672 self.assert_compile(
673 pickle.loads(pickle.dumps(f1)),
674 "percentile_cont(:param_1) WITHIN GROUP (ORDER BY q, p DESC)",
675 )
676
677 def test_functions_with_cols(self):
678 users = table(

Callers

nothing calls this directly

Calls 8

literalFunction · 0.90
columnFunction · 0.90
percentile_contMethod · 0.80
assert_compileMethod · 0.80
within_groupMethod · 0.45
loadsMethod · 0.45
dumpsMethod · 0.45
descMethod · 0.45

Tested by

no test coverage detected