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

Function test_captureresult

testing/test_capture.py:903–930  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

901
902
903def test_captureresult() -> None:
904 cr = CaptureResult("out", "err")
905 assert len(cr) == 2
906 assert cr.out == "out"
907 assert cr.err == "err"
908 out, err = cr
909 assert out == "out"
910 assert err == "err"
911 assert cr[0] == "out"
912 assert cr[1] == "err"
913 assert cr == cr
914 assert cr == CaptureResult("out", "err")
915 assert cr != CaptureResult("wrong", "err")
916 assert cr == ("out", "err")
917 assert cr != ("out", "wrong")
918 assert hash(cr) == hash(CaptureResult("out", "err"))
919 assert hash(cr) == hash(("out", "err"))
920 assert hash(cr) != hash(("out", "wrong"))
921 assert cr < ("z",)
922 assert cr < ("z", "b")
923 assert cr < ("z", "b", "c")
924 assert cr.count("err") == 1
925 assert cr.count("wrong") == 0
926 assert cr.index("err") == 1
927 with pytest.raises(ValueError):
928 assert cr.index("wrong") == 0
929 assert next(iter(cr)) == "out"
930 assert cr._replace(err="replaced") == ("out", "replaced")
931
932
933@pytest.fixture

Callers

nothing calls this directly

Calls 4

countMethod · 0.95
indexMethod · 0.95
_replaceMethod · 0.95
CaptureResultClass · 0.90

Tested by

no test coverage detected