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

Function test_pointer_order

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

Source from the content-addressed store, hash-verified

667
668
669def test_pointer_order():
670 t = T(
671 """
672 ptrA | ptrB | ptrC
673 1 | 11 | 21
674 2 | 12 | 22
675 3 | 13 | 23
676 4 | 14 | 24
677 5 | 15 | 25
678 """
679 ).with_columns(
680 ptrA=pw.this.pointer_from(pw.this.ptrA),
681 ptrB=pw.this.pointer_from(pw.this.ptrB),
682 ptrC=pw.this.pointer_from(pw.this.ptrC),
683 )
684 res = t.select(
685 a1=(t.ptrA < t.ptrB) == (t.ptrA <= t.ptrB),
686 a2=(t.ptrA > t.ptrB) == (t.ptrA >= t.ptrB),
687 a3=(t.ptrB < t.ptrC) == (t.ptrB <= t.ptrC),
688 a4=(t.ptrB > t.ptrC) == (t.ptrB >= t.ptrC),
689 a5=(t.ptrA < t.ptrC) == (t.ptrA <= t.ptrC),
690 a6=(t.ptrA > t.ptrC) == (t.ptrA >= t.ptrC),
691 b1=(t.ptrA < t.ptrB) != (t.ptrA > t.ptrB),
692 b2=(t.ptrA < t.ptrC) != (t.ptrA > t.ptrC),
693 b3=(t.ptrB < t.ptrC) != (t.ptrB > t.ptrC),
694 # <= below on bools is -> implies
695 c1=((t.ptrA < t.ptrB) & (t.ptrB < t.ptrC)) <= (t.ptrA < t.ptrC),
696 c2=((t.ptrA < t.ptrC) & (t.ptrC < t.ptrB)) <= (t.ptrA < t.ptrB),
697 c3=((t.ptrB < t.ptrA) & (t.ptrA < t.ptrC)) <= (t.ptrB < t.ptrC),
698 c4=((t.ptrB < t.ptrC) & (t.ptrC < t.ptrA)) <= (t.ptrB < t.ptrA),
699 c5=((t.ptrC < t.ptrA) & (t.ptrA < t.ptrB)) <= (t.ptrC < t.ptrB),
700 c6=((t.ptrC < t.ptrB) & (t.ptrB < t.ptrA)) <= (t.ptrC < t.ptrA),
701 )
702
703 expected = t.select(
704 a1=True,
705 a2=True,
706 a3=True,
707 a4=True,
708 a5=True,
709 a6=True,
710 b1=True,
711 b2=True,
712 b3=True,
713 c1=True,
714 c2=True,
715 c3=True,
716 c4=True,
717 c5=True,
718 c6=True,
719 )
720 assert_table_equality(res, expected)
721
722
723@pytest.mark.parametrize(

Callers

nothing calls this directly

Calls 4

TFunction · 0.90
with_columnsMethod · 0.80
pointer_fromMethod · 0.45
selectMethod · 0.45

Tested by

no test coverage detected