Beispiel #1
0
 def test_uses_provided_fn_to_map_class_names_to_arg_names(self):
     class SomeClass(object):
         pass
     [implicit_binding] = bindings_lib.get_implicit_class_bindings(
         [SomeClass], get_arg_names_from_class_name=lambda _: ['foo'])
     self.assertEqual(binding_keys.new('foo'),
                      implicit_binding.binding_key)
Beispiel #2
0
 def test_returns_binding_for_input_class(self):
     class SomeClass(object):
         pass
     [implicit_binding] = bindings_lib.get_implicit_class_bindings([SomeClass])
     self.assertEqual(binding_keys.new('some_class'),
                      implicit_binding.binding_key)
     self.assertEqual('a-provided-SomeClass', call_provisor_fn(implicit_binding))
Beispiel #3
0
    def test_uses_provided_fn_to_map_class_names_to_arg_names(self):
        class SomeClass(object):
            pass

        [implicit_binding] = bindings_lib.get_implicit_class_bindings(
            [SomeClass], get_arg_names_from_class_name=lambda _: ['foo'])
        self.assertEqual(binding_keys.new('foo'), implicit_binding.binding_key)
Beispiel #4
0
    def test_returns_binding_for_input_class(self):
        class SomeClass(object):
            pass

        [implicit_binding
         ] = bindings_lib.get_implicit_class_bindings([SomeClass])
        self.assertEqual(binding_keys.new('some_class'),
                         implicit_binding.binding_key)
        self.assertEqual('a-provided-SomeClass',
                         call_provisor_fn(implicit_binding))
Beispiel #5
0
 def test_returns_binding_for_correct_input_class(self):
     class ClassOne(object):
         pass
     class ClassTwo(object):
         pass
     implicit_bindings = bindings_lib.get_implicit_class_bindings(
         [ClassOne, ClassTwo])
     for implicit_binding in implicit_bindings:
         if (implicit_binding.binding_key ==
             binding_keys.new('class_one')):
             self.assertEqual(
                 'a-provided-ClassOne', call_provisor_fn(implicit_binding))
         else:
             self.assertEqual(implicit_binding.binding_key,
                              binding_keys.new('class_two'))
             self.assertEqual(
                 'a-provided-ClassTwo', call_provisor_fn(implicit_binding))
Beispiel #6
0
    def test_returns_binding_for_correct_input_class(self):
        class ClassOne(object):
            pass

        class ClassTwo(object):
            pass

        implicit_bindings = bindings_lib.get_implicit_class_bindings(
            [ClassOne, ClassTwo])
        for implicit_binding in implicit_bindings:
            if (implicit_binding.binding_key == binding_keys.new('class_one')):
                self.assertEqual('a-provided-ClassOne',
                                 call_provisor_fn(implicit_binding))
            else:
                self.assertEqual(implicit_binding.binding_key,
                                 binding_keys.new('class_two'))
                self.assertEqual('a-provided-ClassTwo',
                                 call_provisor_fn(implicit_binding))
Beispiel #7
0
 def test_returns_no_bindings_for_no_input(self):
     self.assertEqual([], bindings_lib.get_implicit_class_bindings([]))
Beispiel #8
0
 def test_returns_no_bindings_for_no_input(self):
     self.assertEqual([], bindings_lib.get_implicit_class_bindings([]))