Exemplo n.º 1
0
 def test_returns_defaults_for_undecorated_fn(self):
     def provide_foo():
         pass
     provider_decorations = decorators.get_provider_fn_decorations(
         provide_foo, ['default-arg-name'])
     self.assertEqual(
         [decorators.ProviderDecoration(
             'default-arg-name', None, scoping.DEFAULT_SCOPE)],
         provider_decorations)
Exemplo n.º 2
0
 def test_returns_defaults_if_no_values_set(self):
     @decorators.annotate_arg('bar', 'unused')
     def provide_foo(bar):
         pass
     provider_decorations = decorators.get_provider_fn_decorations(
         provide_foo, ['default-arg-name'])
     self.assertEqual(
         [decorators.ProviderDecoration(
             'default-arg-name', None, scoping.DEFAULT_SCOPE)],
         provider_decorations)
Exemplo n.º 3
0
 def test_returns_set_values_if_set(self):
     @decorators.provides('foo', annotated_with='an-annotation',
                          in_scope='a-scope-id')
     def provide_foo():
         pass
     provider_decorations = decorators.get_provider_fn_decorations(
         provide_foo, ['default-arg-name'])
     self.assertEqual(
         [decorators.ProviderDecoration(
             'foo', 'an-annotation', 'a-scope-id')],
         provider_decorations)