コード例 #1
0
def test_reassignment():
    options = RcontribOptions()
    options.ab = 5
    assert options.ab == 5
    assert options.to_radiance() == '-ab 5'
    # remove assigned values
    options.ab = None
    assert options.ab == None
    assert options.to_radiance() == ''
コード例 #2
0
def test_invalid_assignment():
    opts = RcontribOptions()
    with pytest.raises(AttributeError):
        opts.mm = 20

    with pytest.raises(TypeError):
        opts.ab = 'ambient bounces'  # must be a numeric value
コード例 #3
0
def test_multiple_assignment():
    options = RcontribOptions()
    options.ab = 2
    options.ad = 546
    options.M = r'.\file with space'
    assert '-ab 2' in options.to_radiance()
    assert 'ad 546' in options.to_radiance()
    assert options.M == typing.normpath(r'.\file with space')