MCPcopy Create free account
hub / github.com/pytest-dev/pytest / test_boolop

Method test_boolop

testing/test_assertrewrite.py:364–441  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

362 result.stdout.fnmatch_lines(["*AssertionError: b'ohai!'", "*assert False"])
363
364 def test_boolop(self) -> None:
365 def f1() -> None:
366 f = g = False
367 assert f and g
368
369 assert getmsg(f1) == "assert (False)"
370
371 def f2() -> None:
372 f = True
373 g = False
374 assert f and g
375
376 assert getmsg(f2) == "assert (True and False)"
377
378 def f3() -> None:
379 f = False
380 g = True
381 assert f and g
382
383 assert getmsg(f3) == "assert (False)"
384
385 def f4() -> None:
386 f = g = False
387 assert f or g
388
389 assert getmsg(f4) == "assert (False or False)"
390
391 def f5() -> None:
392 f = g = False
393 assert not f and not g
394
395 getmsg(f5, must_pass=True)
396
397 def x() -> bool:
398 return False
399
400 def f6() -> None:
401 assert x() and x()
402
403 assert (
404 getmsg(f6, {"x": x})
405 == """assert (False)
406 + where False = x()"""
407 )
408
409 def f7() -> None:
410 assert False or x()
411
412 assert (
413 getmsg(f7, {"x": x})
414 == """assert (False or False)
415 + where False = x()"""
416 )
417
418 def f8() -> None:
419 assert 1 in {} and 2 in {}
420
421 assert getmsg(f8) == "assert (1 in {})"

Callers

nothing calls this directly

Calls 1

getmsgFunction · 0.85

Tested by

no test coverage detected