|
68 | 68 | DifficultParametersTest as _DifficultParametersTest, |
69 | 69 | FetchLimitOffsetTest as _FetchLimitOffsetTest, |
70 | 70 | PostCompileParamsTest, |
| 71 | + StringTest as _StringTest, |
71 | 72 | UuidTest as _UuidTest, |
72 | 73 | ) |
73 | 74 |
|
@@ -442,6 +443,30 @@ def test_uuid_returning(self, connection): |
442 | 443 |
|
443 | 444 | eq_(row, (data, str_data, data, str_data)) |
444 | 445 |
|
| 446 | + class StringTest(_StringTest): |
| 447 | + def test_dont_truncate_rightside( |
| 448 | + self, metadata, connection, expr=None, expected=None |
| 449 | + ): |
| 450 | + t = Table( |
| 451 | + "t", |
| 452 | + metadata, |
| 453 | + Column("x", String(2)), |
| 454 | + Column("id", Integer, primary_key=True), |
| 455 | + ) |
| 456 | + t.create(connection) |
| 457 | + connection.connection.commit() |
| 458 | + connection.execute( |
| 459 | + t.insert(), |
| 460 | + [{"x": "AB", "id": 1}, {"x": "BC", "id": 2}, {"x": "AC", "id": 3}], |
| 461 | + ) |
| 462 | + combinations = [("%B%", ["AB", "BC"]), ("A%C", ["AC"]), ("A%C%Z", [])] |
| 463 | + |
| 464 | + for args in combinations: |
| 465 | + eq_( |
| 466 | + connection.scalars(select(t.c.x).where(t.c.x.like(args[0]))).all(), |
| 467 | + args[1], |
| 468 | + ) |
| 469 | + |
445 | 470 | # from else statement .... |
446 | 471 | del DistinctOnTest # expects unquoted table names. |
447 | 472 | del HasIndexTest # BQ doesn't do the indexes that SQLA is loooking for. |
|
0 commit comments