Example #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}
Example #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}
Example #3
0
 def wrapper(self, *args, **kwargs):
     return func(*args, **dict_merge(self.__options__, kwargs))
Example #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)
Example #5
0
 def wrapper(self, *args, **kwargs):
     return func(*args, **dict_merge(self.__options__, kwargs))
Example #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)
Example #7
0
 def __init__(self, dict=None, **options):
     if dict is not None:
         self.__options__ = dict_merge(dict, options)
     else:
         self.__options__ = options
 def __init__(self, dict=None, **options):
     if dict is not None:
         self.__options__ = dict_merge(dict, options)
     else:
         self.__options__ = options