MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_distinct_function

Method test_distinct_function

test/sql/test_compiler.py:1992–2006  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1990 )
1991
1992 def test_distinct_function(self):
1993 self.assert_compile(
1994 select(func.sum(distinct(table1.c.myid))),
1995 "SELECT sum(DISTINCT mytable.myid) AS sum_1 FROM mytable",
1996 )
1997
1998 self.assert_compile(
1999 select(func.count(table1.c.myid.distinct())),
2000 "SELECT count(DISTINCT mytable.myid) AS count_1 FROM mytable",
2001 )
2002
2003 self.assert_compile(
2004 select(func.count(distinct(table1.c.myid))),
2005 "SELECT count(DISTINCT mytable.myid) AS count_1 FROM mytable",
2006 )
2007
2008 def test_distinct_function_warn_outside_aggregate(self):
2009 with testing.expect_warnings(

Callers

nothing calls this directly

Calls 6

selectFunction · 0.90
distinctFunction · 0.90
assert_compileMethod · 0.80
sumMethod · 0.45
countMethod · 0.45
distinctMethod · 0.45

Tested by

no test coverage detected