MCPcopy
hub / github.com/pathwaycom/pathway / test_lists_lexicographical

Function test_lists_lexicographical

python/pathway/tests/test_operators.py:1331–1365  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1329
1330
1331def test_lists_lexicographical():
1332 def make_list(n) -> list[int]:
1333 return list(range(n))
1334
1335 table = T(
1336 """
1337 a | b
1338 5 | 5
1339 2 | 3
1340 4 | 3
1341 """
1342 ).with_columns(
1343 x=pw.apply(make_list, pw.this.a),
1344 y=pw.apply(make_list, pw.this.b),
1345 )
1346
1347 result = table.select(
1348 pw.this.a,
1349 pw.this.b,
1350 eq=pw.this.x == pw.this.y,
1351 ne=pw.this.x != pw.this.y,
1352 lt=pw.this.x < pw.this.y,
1353 le=pw.this.x <= pw.this.y,
1354 gt=pw.this.x > pw.this.y,
1355 ge=pw.this.x >= pw.this.y,
1356 )
1357 expected = T(
1358 """
1359 a | b | eq | ne | lt | le | gt | ge
1360 5 | 5 | True | False | False | True | False | True
1361 2 | 3 | False | True | True | True | False | False
1362 4 | 3 | False | True | False | False | True | True
1363 """
1364 )
1365 assert_table_equality(result, expected)
1366
1367
1368@pytest.mark.parametrize("cast", ["a", "b"])

Callers

nothing calls this directly

Calls 4

TFunction · 0.90
with_columnsMethod · 0.80
applyMethod · 0.80
selectMethod · 0.45

Tested by

no test coverage detected