| 2206 | |
| 2207 | |
| 2208 | class 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 | |