MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / IsDistinctFromTest

Class IsDistinctFromTest

test/sql/test_operators.py:2208–2277  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2206
2207
2208class IsDistinctFromTest(fixtures.TestBase, testing.AssertsCompiledSQL):
2209 __dialect__ = "default"
2210
2211 table1 = table("mytable", column("myid", Integer))
2212
2213 def test_is_distinct_from(self):
2214 self.assert_compile(
2215 self.table1.c.myid.is_distinct_from(1),
2216 "mytable.myid IS DISTINCT FROM :myid_1",
2217 )
2218
2219 def test_is_distinct_from_sqlite(self):
2220 self.assert_compile(
2221 self.table1.c.myid.is_distinct_from(1),
2222 "mytable.myid IS NOT ?",
2223 dialect=sqlite.dialect(),
2224 )
2225
2226 def test_is_distinct_from_postgresql(self):
2227 self.assert_compile(
2228 self.table1.c.myid.is_distinct_from(1),
2229 "mytable.myid IS DISTINCT FROM %(myid_1)s::INTEGER",
2230 dialect=postgresql.dialect(),
2231 )
2232
2233 def test_not_is_distinct_from(self):
2234 self.assert_compile(
2235 ~self.table1.c.myid.is_distinct_from(1),
2236 "mytable.myid IS NOT DISTINCT FROM :myid_1",
2237 )
2238
2239 def test_not_is_distinct_from_postgresql(self):
2240 self.assert_compile(
2241 ~self.table1.c.myid.is_distinct_from(1),
2242 "mytable.myid IS NOT DISTINCT FROM %(myid_1)s::INTEGER",
2243 dialect=postgresql.dialect(),
2244 )
2245
2246 def test_is_not_distinct_from(self):
2247 self.assert_compile(
2248 self.table1.c.myid.is_not_distinct_from(1),
2249 "mytable.myid IS NOT DISTINCT FROM :myid_1",
2250 )
2251
2252 def test_is_not_distinct_from_sqlite(self):
2253 self.assert_compile(
2254 self.table1.c.myid.is_not_distinct_from(1),
2255 "mytable.myid IS ?",
2256 dialect=sqlite.dialect(),
2257 )
2258
2259 def test_is_not_distinct_from_postgresql(self):
2260 self.assert_compile(
2261 self.table1.c.myid.is_not_distinct_from(1),
2262 "mytable.myid IS NOT DISTINCT FROM %(myid_1)s::INTEGER",
2263 dialect=postgresql.dialect(),
2264 )
2265

Callers

nothing calls this directly

Calls 2

tableFunction · 0.90
columnFunction · 0.90

Tested by

no test coverage detected