Did I find the right examples for you? yes no

All Samples(5)  |  Call(5)  |  Derive(0)  |  Import(0)

src/n/i/nibabel-1.3.0/nibabel/tests/test_batteryrunners.py   nibabel(Download)
    rep.write_raise(str_io)
    assert_equal(str_io.getvalue(), 'Level 30: msg; fix\n')
    str_io.truncate(0); str_io.seek(0)
    # No fix string, no fix message
    rep.fix_msg = ''
    rep.write_raise(str_io)
    assert_equal(str_io.getvalue(), 'Level 30: msg\n')
    rep.fix_msg = 'fix'
    str_io.truncate(0); str_io.seek(0)
    rep.write_raise(str_io, log_level=20)
    assert_equal(str_io.getvalue(), 'Level 20: msg; fix\n')
    str_io.truncate(0); str_io.seek(0)
    # If we set the error level down this low, we raise an error
    assert_raises(ValueError, rep.write_raise, str_io, 20)
    assert_equal(str_io.getvalue(), 'Level 20: msg; fix\n')
    # If there's no error, we can't raise
    str_io.truncate(0); str_io.seek(0)
    rep.error = None
    rep.write_raise(str_io, 20)
    rep.log_raise(logger)
    assert_equal(str_io.getvalue(), 'msg; fix\n')
    str_io.truncate(0); str_io.seek(0)