MCPcopy Index your code
hub / github.com/pathwaycom/pathway / test_method_in_ix

Function test_method_in_ix

python/pathway/tests/test_transformers.py:1034–1069  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1032
1033
1034def test_method_in_ix():
1035 @transformer
1036 class foo_transformer:
1037 class table(ClassArg):
1038 a: int = input_attribute()
1039
1040 @method
1041 def method(self, arg) -> int:
1042 return self.a * arg
1043
1044 input = T(
1045 """
1046 | c | b
1047 7 | 1 | 10
1048 8 | 2 | 10
1049 9 | 3 | 20
1050 """
1051 )
1052
1053 reduced = input.groupby(input.b).reduce(a=input.b)
1054
1055 oracle = foo_transformer(reduced).table
1056
1057 result = input.select(res=oracle.ix_ref(input.b).method(input.c))
1058
1059 assert_table_equality(
1060 result,
1061 T(
1062 """
1063 | res
1064 7 | 10
1065 8 | 20
1066 9 | 60
1067 """
1068 ),
1069 )
1070
1071
1072def test_method_in_groupby():

Callers

nothing calls this directly

Calls 7

TFunction · 0.90
methodMethod · 0.80
foo_transformerClass · 0.70
reduceMethod · 0.45
groupbyMethod · 0.45
selectMethod · 0.45
ix_refMethod · 0.45

Tested by

no test coverage detected