()
| 1070 | |
| 1071 | |
| 1072 | def test_method_in_groupby(): |
| 1073 | @transformer |
| 1074 | class foo_transformer: |
| 1075 | class table(ClassArg): |
| 1076 | a: int = input_attribute() |
| 1077 | |
| 1078 | @method |
| 1079 | def method(self, arg) -> int: |
| 1080 | return self.a * arg |
| 1081 | |
| 1082 | input = T( |
| 1083 | """ |
| 1084 | a | grouper |
| 1085 | 1 | 1 |
| 1086 | 2 | 1 |
| 1087 | 3 | 2 |
| 1088 | 4 | 2 |
| 1089 | 5 | 3 |
| 1090 | 6 | 3 |
| 1091 | """, |
| 1092 | ) |
| 1093 | |
| 1094 | oracle = foo_transformer(input).table |
| 1095 | |
| 1096 | combined = input + oracle |
| 1097 | |
| 1098 | result = combined.groupby(combined.grouper).reduce( |
| 1099 | res=reducers.sum(combined.method(combined.a)) |
| 1100 | ) |
| 1101 | assert_table_equality_wo_index( |
| 1102 | result, |
| 1103 | T( |
| 1104 | """ |
| 1105 | res |
| 1106 | 5 |
| 1107 | 25 |
| 1108 | 61 |
| 1109 | """, |
| 1110 | ), |
| 1111 | ) |
nothing calls this directly
no test coverage detected