def test_boot_without_root(self): expected = [ 'boot.load_me_cdi', 'boot.deep.me_too_cdi', ] boot_cdi(paths=['boot/*_cdi.py', 'boot/deep/*_cdi.py']) result = [new(str, 'load_me'), new(str, 'me_too')] self.assertEqual(expected, result)
def test_init_complex_class(self): complex_class = new(ComplexClass) self.assertIsInstance(complex_class, ComplexClass) self.assertIsNotNone(complex_class) self.assertEqual(type(complex_class.a), SubclassA) self.assertEqual(type(complex_class.b), SubclassB) self.assertEqual(complex_class.some_string, SOME_STRING) self.assertEqual(complex_class.another_string, ANOTHER_STRING) complex_class.a.do_something() complex_class.b.do_something()
def test_another_subclass(self): expected = SubclassB result = type(new(BaseClass, context='another')) self.assertEqual(expected, result)
def test_default_subclass(self): expected = SubclassA result = type(new(BaseClass)) self.assertEqual(expected, result)
def test_another_str_producer(self): expected = ANOTHER_STRING result = new(str, context='another') self.assertEqual(expected, result)
def test_default_str_producer(self): expected = SOME_STRING result = new(str) self.assertEqual(expected, result)
def test_method_with_injection(self): DEFAULT_CONTAINER.register_instance(self) complex_class = new(ComplexClass) call(complex_class.method_with_injection)