(self, connection)
| 575 | assert len(r) == 0 |
| 576 | |
| 577 | def test_expanding_in(self, connection): |
| 578 | users = self.tables.users |
| 579 | connection.execute( |
| 580 | users.insert(), |
| 581 | [ |
| 582 | dict(user_id=7, user_name="jack"), |
| 583 | dict(user_id=8, user_name="fred"), |
| 584 | dict(user_id=9, user_name=None), |
| 585 | ], |
| 586 | ) |
| 587 | |
| 588 | stmt = ( |
| 589 | select(users) |
| 590 | .where(users.c.user_name.in_(bindparam("uname", expanding=True))) |
| 591 | .order_by(users.c.user_id) |
| 592 | ) |
| 593 | |
| 594 | eq_( |
| 595 | connection.execute(stmt, {"uname": ["jack"]}).fetchall(), |
| 596 | [(7, "jack")], |
| 597 | ) |
| 598 | |
| 599 | eq_( |
| 600 | connection.execute(stmt, {"uname": ["jack", "fred"]}).fetchall(), |
| 601 | [(7, "jack"), (8, "fred")], |
| 602 | ) |
| 603 | |
| 604 | eq_(connection.execute(stmt, {"uname": []}).fetchall(), []) |
| 605 | |
| 606 | assert_raises_message( |
| 607 | exc.StatementError, |
| 608 | "'expanding' parameters can't be used with executemany()", |
| 609 | connection.execute, |
| 610 | users.update().where( |
| 611 | users.c.user_name.in_(bindparam("uname", expanding=True)) |
| 612 | ), |
| 613 | [{"uname": ["fred"]}, {"uname": ["ed"]}], |
| 614 | ) |
| 615 | |
| 616 | @testing.requires.no_quoting_special_bind_names |
| 617 | def test_expanding_in_special_chars(self, connection): |
nothing calls this directly
no test coverage detected