Example #1
0
def test_namespace_no_promote_overwrite():
    x = Namespace(x=17)
    x.setitem_path('x__z', 42)
    assert Namespace(x__z=42) == x
Example #2
0
def test_namespace_no_promote_overwrite_backwards():
    x = Namespace(x__z=42)
    x.setitem_path('x', 17)
    assert Namespace(x=17) == x
Example #3
0
def test_namespace_setitem_function_dict():
    x = Namespace(f=f)
    x.setitem_path('f', dict(x=17))
    assert dict(f=dict(call_target=f, x=17)) == x
Example #4
0
def test_namespace_setitem_function_non_dict():
    x = Namespace(f=f)
    x.setitem_path('f', 17)
    assert dict(f=17) == x
Example #5
0
def test_namespace_setitem_promote_string_to_namespace():
    x = Namespace(x='y')
    x.setitem_path('x__z', 17)
    assert dict(x=dict(y=True, z=17)) == x
Example #6
0
def test_namespace_setitem_function_backward():
    x = Namespace(f__x=17)
    x.setitem_path('f', f)
    assert dict(f=dict(call_target=f, x=17)) == x
Example #7
0
def test_namespace_setitem_namespace_merge():
    x = Namespace(x__y=17)
    x.setitem_path('x__z', 42)
    assert dict(x=dict(y=17, z=42)) == x
Example #8
0
def test_namespace_setitem_split_path_overwrite():
    x = Namespace(x__y=17)
    x.setitem_path('x__y', 42)
    assert dict(x=dict(y=42)) == x
Example #9
0
def test_namespace_setitem_split_path():
    x = Namespace()
    x.setitem_path('x__y', 17)
    assert dict(x=dict(y=17))
Example #10
0
def test_namespace_setitem_singe_value_overwrite():
    x = Namespace(x=17)
    x.setitem_path('x', 42)
    assert dict(x=42) == x
Example #11
0
def test_namespace_setitem_single_value():
    x = Namespace()
    x.setitem_path('x', 17)
    assert dict(x=17) == x