MCPcopy
hub / github.com/pytest-dev/pytest / test_boolop

Method test_boolop

testing/test_assertrewrite.py:575–652  ·  testing/test_assertrewrite.py::TestAssertionRewrite.test_boolop
(self)

Source from the content-addressed store, hash-verified

573 result.stdout.re_match_lines([rclass="st">".*AssertionError: A+$", class="st">".*assert False"])
574
575 def test_boolop(self) -> None:
576 def f1() -> None:
577 f = g = False
578 assert f and g
579
580 assert getmsg(f1) == class="st">"assert (False)"
581
582 def f2() -> None:
583 f = True
584 g = False
585 assert f and g
586
587 assert getmsg(f2) == class="st">"assert (True and False)"
588
589 def f3() -> None:
590 f = False
591 g = True
592 assert f and g
593
594 assert getmsg(f3) == class="st">"assert (False)"
595
596 def f4() -> None:
597 f = g = False
598 assert f or g
599
600 assert getmsg(f4) == class="st">"assert (False or False)"
601
602 def f5() -> None:
603 f = g = False
604 assert not f and not g
605
606 getmsg(f5, must_pass=True)
607
608 def x() -> bool:
609 return False
610
611 def f6() -> None:
612 assert x() and x()
613
614 assert (
615 getmsg(f6, {class="st">"x": x})
616 == class="st">"""assert (False)
617 + where False = x()class="st">"""
618 )
619
620 def f7() -> None:
621 assert False or x()
622
623 assert (
624 getmsg(f7, {class="st">"x": x})
625 == class="st">"""assert (False or False)
626 + where False = x()class="st">"""
627 )
628
629 def f8() -> None:
630 assert 1 in {} and 2 in {}
631
632 assert getmsg(f8) == class="st">"assert (1 in {})"

Callers

nothing calls this directly

Calls 1

getmsgFunction · 0.85

Tested by

no test coverage detected