Exemple #1
0
    def test_inheritance__with_override__and_super_call(self):
        retval = 42
        Foo = self._create_abstract_method_class(method=const(retval))

        class Bar(Foo):
            def foo(self):
                return super(Bar, self).foo()

        self.assertEquals(retval, Bar().foo())
Exemple #2
0
 def test_dicts(self):
     dict_ = __unit__.const(self.DICT)
     self.assertIs(self.DICT, dict_())
     self.assertIsNot(self.DICT_COPY, dict_())
Exemple #3
0
 def test_object(self):
     object_ = __unit__.const(self.OBJECT)
     self.assertIs(self.OBJECT, object_())
     self.assertIsNot(self.DIFFERENT_OBJECT, object_())
Exemple #4
0
 def test_empty_dicts(self):
     empty_dict = __unit__.const(self.EMPTY_DICT)
     self.assertIs(self.EMPTY_DICT, empty_dict())
     self.assertIsNot(self.DIFFERENT_EMPTY_DICT, empty_dict())
Exemple #5
0
 def test_lists(self):
     list_ = __unit__.const(self.LIST)
     self.assertIs(self.LIST, list_())
     self.assertIsNot(self.DIFFERENT_EMPTY_LIST, list_())
Exemple #6
0
 def test_empty_lists(self):
     empty_list = __unit__.const(self.EMPTY_LIST)
     self.assertIs(self.EMPTY_LIST, empty_list())
     self.assertIsNot(self.DIFFERENT_EMPTY_LIST, empty_list())
Exemple #7
0
 def test_values(self):
     self.assertIsNone(__unit__.const(None)())
     self.assertIs(0, __unit__.const(0)())
     self.assertIs(self.EMPTY_TUPLE, __unit__.const(self.EMPTY_TUPLE)())
Exemple #8
0
 def test_string__with_args__module(self):
     call = __unit__.dotcall(__unit__.const.__name__, self.ARGUMENT)
     self.assertResultsEqual(__unit__.const(self.ARGUMENT), call(__unit__))