| 107 | |
| 108 | |
| 109 | class DefaultColumnComparatorTest( |
| 110 | testing.AssertsCompiledSQL, fixtures.TestBase |
| 111 | ): |
| 112 | dialect = __dialect__ = "default_enhanced" |
| 113 | |
| 114 | @testing.combinations((operators.desc_op, desc), (operators.asc_op, asc)) |
| 115 | def test_scalar(self, operator, compare_to): |
| 116 | left = column("left") |
| 117 | assert left.comparator.operate(operator).compare(compare_to(left)) |
| 118 | self._loop_test(operator) |
| 119 | |
| 120 | right_column = column("right") |
| 121 | |
| 122 | @testing.combinations( |
| 123 | (operators.add, right_column), |
| 124 | (operators.is_, None), |
| 125 | (operators.is_not, None), |
| 126 | (operators.isnot, None), # deprecated 1.4; See #5429 |
| 127 | (operators.is_, null()), |
| 128 | (operators.is_, true()), |
| 129 | (operators.is_, false()), |
| 130 | (operators.eq, True), |
| 131 | (operators.ne, True), |
| 132 | (operators.is_distinct_from, True), |
| 133 | (operators.is_distinct_from, False), |
| 134 | (operators.is_distinct_from, None), |
| 135 | (operators.is_not_distinct_from, True), |
| 136 | (operators.isnot_distinct_from, True), # deprecated 1.4; See #5429 |
| 137 | (operators.is_, True), |
| 138 | (operators.is_not, True), |
| 139 | (operators.isnot, True), # deprecated 1.4; See #5429 |
| 140 | (operators.is_, False), |
| 141 | (operators.is_not, False), |
| 142 | (operators.isnot, False), # deprecated 1.4; See #5429 |
| 143 | (operators.like_op, right_column), |
| 144 | (operators.not_like_op, right_column), |
| 145 | (operators.notlike_op, right_column), # deprecated 1.4; See #5435 |
| 146 | (operators.ilike_op, right_column), |
| 147 | (operators.not_ilike_op, right_column), |
| 148 | (operators.notilike_op, right_column), # deprecated 1.4; See #5435 |
| 149 | (operators.is_, right_column), |
| 150 | (operators.is_not, right_column), |
| 151 | (operators.isnot, right_column), # deprecated 1.4; See #5429 |
| 152 | (operators.concat_op, right_column), |
| 153 | id_="ns", |
| 154 | ) |
| 155 | def test_operate(self, operator, right): |
| 156 | left = column("left") |
| 157 | |
| 158 | if operators.is_comparison(operator): |
| 159 | type_ = sqltypes.BOOLEANTYPE |
| 160 | else: |
| 161 | type_ = sqltypes.NULLTYPE |
| 162 | |
| 163 | assert left.comparator.operate(operator, right).compare( |
| 164 | BinaryExpression( |
| 165 | coercions.expect(roles.WhereHavingRole, left), |
| 166 | coercions.expect(roles.WhereHavingRole, right), |