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

Function test_table_add_method_table

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

Source from the content-addressed store, hash-verified

365
366
367def 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
406def test_method_call_in_transformer_with_input_attribute():

Callers

nothing calls this directly

Calls 4

TFunction · 0.90
foo_transformerClass · 0.70
selectMethod · 0.45
cMethod · 0.45

Tested by

no test coverage detected