()
| 365 | |
| 366 | |
| 367 | def test_table_add_method_table(): |
| 368 | @transformer |
| 369 | class foo_transformer: |
| 370 | class table(ClassArg): |
| 371 | a: int = input_attribute() |
| 372 | |
| 373 | @output_attribute |
| 374 | def b(self) -> int: |
| 375 | return self.a * 10 |
| 376 | |
| 377 | @method |
| 378 | def c(self, arg) -> int: |
| 379 | return (self.a + self.b) * arg |
| 380 | |
| 381 | input = T( |
| 382 | """ |
| 383 | | a |
| 384 | 1 | 1 |
| 385 | 2 | 2 |
| 386 | 3 | 3 |
| 387 | """ |
| 388 | ) |
| 389 | |
| 390 | method_table = foo_transformer(input).table + input.select(d=-input.a) |
| 391 | result = method_table.select(ret=method_table.c(10)) |
| 392 | |
| 393 | assert_table_equality( |
| 394 | result, |
| 395 | T( |
| 396 | """ |
| 397 | | ret |
| 398 | 1 | 110 |
| 399 | 2 | 220 |
| 400 | 3 | 330 |
| 401 | """ |
| 402 | ), |
| 403 | ) |
| 404 | |
| 405 | |
| 406 | def test_method_call_in_transformer_with_input_attribute(): |
nothing calls this directly
no test coverage detected