예제 #1
0
 def test_set_get_class(self):
     cfg = SimplerConfig()
     cfg.c = MockClass
     cfg.c.args = [10, 2, 3]
     cfg.c.kwargs["hello"] = 2
     self.assertEqual(cfg.c.object, MockClass)
     self.assertTupleEqual(cfg.c.instance.bar(), ((10, 2, 3), {'hello': 2}))
예제 #2
0
 def test_set_get_function(self):
     cfg = SimplerConfig()
     cfg.c = mock_foo
     cfg.c.args = [10, 2, 3]
     cfg.c.kwargs["hello"] = 2
     self.assertEqual(mock_foo, cfg.c.object)
     self.assertTupleEqual(((10, 2, 3), {'hello': 2}), cfg.c.call)
예제 #3
0
    def test_complex_conf_arguments_to_class(self):
        cfg = SimplerConfig()
        cfg.globals.global_var = "global information"
        cfg.c = TestConfClass
        cfg.c.kwargs.some_info = "information"
        cfg.c.kwargs.conf.conf_class = MockClass
        cfg.c.kwargs.conf.conf_class.args = [2, 5, 1]
        cfg.c.kwargs.conf.conf_class.kwargs = {'hello': 2}

        self.assertTupleEqual(cfg.c.instance.foo(),
                              ("information", "global information",
                               ((2, 5, 1), {
                                   'hello': 2
                               })))