Exemple #1
0
 def test_new_binds_only_initial_values_explicit_ctx_class(self, proxy):
     proxy = BoundLoggerLazyProxy(None,
                                  initial_values={
                                      "a": 1,
                                      "b": 2
                                  },
                                  context_class=dict)
     b = proxy.new(foo=42)
     assert {"a": 1, "b": 2, "foo": 42} == b._context
Exemple #2
0
    def test_new_binds_only_initial_values_implicit_ctx_class(self, proxy):
        """
        new() doesn't clear initial_values if context_class comes from config.
        """
        proxy = BoundLoggerLazyProxy(None, initial_values={"a": 1, "b": 2})

        b = proxy.new(foo=42)

        assert {"a": 1, "b": 2, "foo": 42} == b._context
Exemple #3
0
 def test_new_binds_only_initial_values_explicit_ctx_class(self, proxy):
     """
     new() doesn't clear initial_values if context_class is passed
     explicitly..
     """
     proxy = BoundLoggerLazyProxy(None,
                                  initial_values={
                                      "a": 1,
                                      "b": 2
                                  },
                                  context_class=dict)
     b = proxy.new(foo=42)
     assert {"a": 1, "b": 2, "foo": 42} == b._context
Exemple #4
0
 def test_new_binds_only_initial_values_explicit_ctx_class(self, proxy):
     proxy = BoundLoggerLazyProxy(None, initial_values={"a": 1, "b": 2}, context_class=dict)
     b = proxy.new(foo=42)
     assert {"a": 1, "b": 2, "foo": 42} == b._context
Exemple #5
0
 def test_new_binds_only_initial_values_impolicit_ctx_class(self, proxy):
     proxy = BoundLoggerLazyProxy(None, initial_values={'a': 1, 'b': 2})
     b = proxy.new(foo=42)
     assert {'a': 1, 'b': 2, 'foo': 42} == b._context
Exemple #6
0
 def test_new_binds_only_initial_values_impolicit_ctx_class(self, proxy):
     proxy = BoundLoggerLazyProxy(None, initial_values={'a': 1, 'b': 2})
     b = proxy.new(foo=42)
     assert {'a': 1, 'b': 2, 'foo': 42} == b._context