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

Function test_tuples_int_float

python/pathway/tests/test_operators.py:1369–1403  ·  view source on GitHub ↗
(cast: str)

Source from the content-addressed store, hash-verified

1367
1368@pytest.mark.parametrize("cast", ["a", "b"])
1369def test_tuples_int_float(cast: str):
1370 table = (
1371 T(
1372 """
1373 a | b
1374 1 | 1
1375 2 | 3
1376 4 | 3
1377 """
1378 )
1379 .with_columns(**{cast: pw.cast(float, pw.this[cast])})
1380 .with_columns(
1381 x=pw.make_tuple(pw.this.a, pw.this.b), y=pw.make_tuple(pw.this.b, pw.this.a)
1382 )
1383 )
1384
1385 result = table.select(
1386 pw.this.a,
1387 pw.this.b,
1388 eq=pw.this.x == pw.this.y,
1389 ne=pw.this.x != pw.this.y,
1390 lt=pw.this.x < pw.this.y,
1391 le=pw.this.x <= pw.this.y,
1392 gt=pw.this.x > pw.this.y,
1393 ge=pw.this.x >= pw.this.y,
1394 )
1395 expected = T(
1396 """
1397 a | b | eq | ne | lt | le | gt | ge
1398 1 | 1 | True | False | False | True | False | True
1399 2 | 3 | False | True | True | True | False | False
1400 4 | 3 | False | True | False | False | True | True
1401 """
1402 ).with_columns(**{cast: pw.cast(float, pw.this[cast])})
1403 assert_table_equality(result, expected)
1404
1405
1406def test_tuples_none():

Callers

nothing calls this directly

Calls 3

TFunction · 0.90
with_columnsMethod · 0.80
selectMethod · 0.45

Tested by

no test coverage detected