コード例 #1
0
def test_map_liveproperty():
    assert prop.providing_class("livewidget") is PropertyForLiveUse

    with assert_raises(NameError):
        prop.providing_class("widget") # unavailable as a live property
コード例 #2
0
def test_map_nonexistent_name():
    with assert_raises(NameError):
        prop.providing_class("widget", soh.HandlerBase)
    with assert_raises(NameError):
        prop.providing_class("robin", _TestOutputHandler1)
コード例 #3
0
def test_map_overloaded_name():
    assert prop.providing_class("widget", _TestOutputHandler1) is PropertyForHandler1
    assert prop.providing_class("widget", _TestOutputHandler2) is PropertyForHandler2
コード例 #4
0
def test_map_precedence():
    # The most specific version of the property should be used, not the "more generic" version (PropertyForHandler1):
    assert prop.providing_class("hedgehog", _TestOutputHandler1Child) is PropertyForHandler1Child
コード例 #5
0
def test_map_unique_name():
    assert prop.providing_class("robin", _TestOutputHandler2) is PropertyForHandler2
    assert prop.providing_class("hedgehog", _TestOutputHandler1) is PropertyForHandler1