示例#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)