Ejemplo n.º 1
0
def test_dict_merge():
    assert dict_merge({}, {1: x, y: z}) == {1: x, y: z}
    assert dict_merge({1: x, y: z}, {}) == {1: x, y: z}

    assert dict_merge({2: z}, {1: x, y: z}) == {1: x, 2: z, y: z}
    assert dict_merge({1: x, y: z}, {2: z}) == {1: x, 2: z, y: z}

    assert dict_merge({1: y, 2: z}, {1: x, y: z}) == {1: x, 2: z, y: z}
    assert dict_merge({1: x, y: z}, {1: y, 2: z}) == {1: y, 2: z, y: z}
Ejemplo n.º 2
0
def test_dict_merge():
    assert dict_merge({}, {1: x, y: z}) == {1: x, y: z}
    assert dict_merge({1: x, y: z}, {}) == {1: x, y: z}

    assert dict_merge({2: z}, {1: x, y: z}) == {1: x, 2: z, y: z}
    assert dict_merge({1: x, y: z}, {2: z}) == {1: x, 2: z, y: z}

    assert dict_merge({1: y, 2: z}, {1: x, y: z}) == {1: x, 2: z, y: z}
    assert dict_merge({1: x, y: z}, {1: y, 2: z}) == {1: y, 2: z, y: z}
Ejemplo n.º 3
0
 def wrapper(self, *args, **kwargs):
     return func(*args, **dict_merge(self.__options__, kwargs))
Ejemplo n.º 4
0
 def __and__(self, other):
     if isinstance(other, Context):
         return Context(**dict_merge(self.__options__, other.__options__))
     else:
         raise TypeError("a context manager expected, got %s" % other)
Ejemplo n.º 5
0
 def wrapper(self, *args, **kwargs):
     return func(*args, **dict_merge(self.__options__, kwargs))
Ejemplo n.º 6
0
 def __and__(self, other):
     if isinstance(other, Context):
         return Context(**dict_merge(self.__options__, other.__options__))
     else:
         raise TypeError("a context manager expected, got %s" % other)
Ejemplo n.º 7
0
 def __init__(self, dict=None, **options):
     if dict is not None:
         self.__options__ = dict_merge(dict, options)
     else:
         self.__options__ = options
Ejemplo n.º 8
0
 def __init__(self, dict=None, **options):
     if dict is not None:
         self.__options__ = dict_merge(dict, options)
     else:
         self.__options__ = options