예제 #1
0
파일: test_tbx.py 프로젝트: tbarron/tbx
def test_fatal_number():
    """
    fatal(non-string) should throw a SystemExit with str(message)
    """
    msg = 32.198
    with pytest.raises(SystemExit) as err:
        tbx.fatal(msg)
    assert str(msg) in str(err)
예제 #2
0
파일: test_tbx.py 프로젝트: tbarron/tbx
def test_fatal_msg():
    """
    fatal(non-empty message) should throw a SystemExit with the message
    """
    msg = 'This is a fatal error message'
    with pytest.raises(SystemExit) as err:
        tbx.fatal(msg)
    assert msg in str(err)
예제 #3
0
파일: test_tbx.py 프로젝트: tbarron/tbx
def test_fatal_empty():
    """
    fatal(empty message) should throw a SystemExit with some non-empty message
    """
    exp = 'Fatal error with no reason specified'
    with pytest.raises(SystemExit) as err:
        tbx.fatal()
    assert exp in str(err)
예제 #4
0
def test_fatal_number():
    """
    fatal(non-string) should throw a SystemExit with str(message)
    """
    pytest.dbgfunc()
    msg = 32.198
    with pytest.raises(SystemExit) as err:
        tbx.fatal(msg)
    assert str(msg) in str(err.value)
예제 #5
0
def test_fatal_msg():
    """
    fatal(non-empty message) should throw a SystemExit with the message
    """
    pytest.dbgfunc()
    msg = 'This is a fatal error message'
    with pytest.raises(SystemExit) as err:
        tbx.fatal(msg)
    assert msg in str(err.value)
예제 #6
0
def test_fatal_empty():
    """
    fatal(empty message) should throw a SystemExit with some non-empty message
    """
    pytest.dbgfunc()
    exp = 'Fatal error with no reason specified'
    with pytest.raises(SystemExit) as err:
        tbx.fatal()
    assert exp in str(err.value)