Exemplo n.º 1
0
 def test_no_target(self):
     proxy = Proxy()
     with self.assertRaises(AttributeError):
         proxy.foo
     with self.assertRaises(AttributeError):
         proxy.bar()
         
Exemplo n.º 2
0
 def test_not_found(self):
     class Target(object):
         pass
     proxy = Proxy(Target())
     with self.assertRaises(AttributeError):
         proxy.foo
     with self.assertRaises(AttributeError):
         proxy.bar()
Exemplo n.º 3
0
    def test_not_found(self):
        class Target(object):
            pass

        proxy = Proxy(Target())
        with self.assertRaises(AttributeError):
            proxy.foo
        with self.assertRaises(AttributeError):
            proxy.bar()
Exemplo n.º 4
0
 def test_found_in_target(self):
     class Target(object):
         def __init__(self):
             self.foo = 'foo'
              
         def bar(self):
             return 'bar'
     proxy = Proxy(Target())
     self.assertEqual('foo', proxy.foo)
     self.assertEqual('bar', proxy.bar())
Exemplo n.º 5
0
    def test_found_in_target(self):
        class Target(object):
            def __init__(self):
                self.foo = 'foo'

            def bar(self):
                return 'bar'

        proxy = Proxy(Target())
        self.assertEqual('foo', proxy.foo)
        self.assertEqual('bar', proxy.bar())
Exemplo n.º 6
0
 def test_no_target(self):
     proxy = Proxy()
     with self.assertRaises(AttributeError):
         proxy.foo
     with self.assertRaises(AttributeError):
         proxy.bar()