예제 #1
0
 def testBindScope(self):
     class Scope(object): pass
     scope = Scope()
     
     injector = Injector()
     injector.bind_scope(Scope, scope)
     
     self.assertTrue(injector.get(Scope) is scope)
     self.assertTrue(injector.is_scope_bound(Scope))
예제 #2
0
 def testUnbindScope(self):
     class Scope(object): pass
     scope = Scope()
     
     injector = Injector()
     injector.bind_scope(Scope, scope)
     
     injector.unbind_scope(Scope)
     self.assertFalse(injector.is_bound(Scope))
     self.assertFalse(injector.is_scope_bound(Scope))
예제 #3
0
    def testBindScope(self):
        class Scope(object):
            pass

        scope = Scope()

        injector = Injector()
        injector.bind_scope(Scope, scope)

        self.assertTrue(injector.get(Scope) is scope)
        self.assertTrue(injector.is_scope_bound(Scope))
예제 #4
0
    def testUnbindScope(self):
        class Scope(object):
            pass

        scope = Scope()

        injector = Injector()
        injector.bind_scope(Scope, scope)

        injector.unbind_scope(Scope)
        self.assertFalse(injector.is_bound(Scope))
        self.assertFalse(injector.is_scope_bound(Scope))