Test standalone OrderByList with various operators
(self)
| 8416 | __dialect__ = "default" |
| 8417 | |
| 8418 | def test_order_by_list(self): |
| 8419 | """Test standalone OrderByList with various operators""" |
| 8420 | col1 = Column("x", Integer) |
| 8421 | col2 = Column("y", Integer) |
| 8422 | |
| 8423 | # Test basic OrderByList creation |
| 8424 | order_list = OrderByList([col1, col2]) |
| 8425 | self.assert_compile( |
| 8426 | select(literal(1)).order_by(order_list), |
| 8427 | "SELECT :param_1 AS anon_1 ORDER BY x, y", |
| 8428 | ) |
| 8429 | |
| 8430 | # Test OrderByList with desc |
| 8431 | order_list_desc = order_list.desc() |
| 8432 | self.assert_compile( |
| 8433 | select(literal(1)).order_by(order_list_desc), |
| 8434 | "SELECT :param_1 AS anon_1 ORDER BY x DESC, y DESC", |
| 8435 | ) |
| 8436 | |
| 8437 | # Test OrderByList with asc |
| 8438 | order_list_asc = order_list.asc() |
| 8439 | self.assert_compile( |
| 8440 | select(literal(1)).order_by(order_list_asc), |
| 8441 | "SELECT :param_1 AS anon_1 ORDER BY x ASC, y ASC", |
| 8442 | ) |
| 8443 | |
| 8444 | # Test OrderByList with nulls_first |
| 8445 | order_list_nf = order_list.nulls_first() |
| 8446 | self.assert_compile( |
| 8447 | select(literal(1)).order_by(order_list_nf), |
| 8448 | "SELECT :param_1 AS anon_1 ORDER BY x NULLS FIRST, y NULLS FIRST", |
| 8449 | ) |
| 8450 | |
| 8451 | # Test OrderByList with nulls_last |
| 8452 | order_list_nl = order_list.nulls_last() |
| 8453 | self.assert_compile( |
| 8454 | select(literal(1)).order_by(order_list_nl), |
| 8455 | "SELECT :param_1 AS anon_1 ORDER BY x NULLS LAST, y NULLS LAST", |
| 8456 | ) |
| 8457 | |
| 8458 | def test_order_by_list_chained_ops(self): |
| 8459 | """Test chained operations on OrderByList""" |
nothing calls this directly
no test coverage detected