Test result row processing when selecting from a plain bind param.
(self, connection)
| 323 | |
| 324 | @testing.requires.standalone_binds |
| 325 | def test_select_from_bindparam(self, connection): |
| 326 | """Test result row processing when selecting from a plain bind |
| 327 | param.""" |
| 328 | |
| 329 | class MyInteger(TypeDecorator): |
| 330 | impl = Integer |
| 331 | cache_ok = True |
| 332 | |
| 333 | def process_bind_param(self, value, dialect): |
| 334 | return int(value[4:]) |
| 335 | |
| 336 | def process_result_value(self, value, dialect): |
| 337 | return "INT_%d" % value |
| 338 | |
| 339 | eq_( |
| 340 | connection.scalar(select(cast("INT_5", type_=MyInteger))), |
| 341 | "INT_5", |
| 342 | ) |
| 343 | eq_( |
| 344 | connection.scalar( |
| 345 | select(cast("INT_5", type_=MyInteger).label("foo")) |
| 346 | ), |
| 347 | "INT_5", |
| 348 | ) |
| 349 | |
| 350 | def test_order_by(self, connection): |
| 351 | """Exercises ORDER BY clause generation. |