mock.sentinel.Frooble

Here are the examples of the python api mock.sentinel.Frooble taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

4 Examples 7

3 Source : testpatch.py
with GNU General Public License v3.0
from guohuadeng

    def test_patch_with_create_mocks_non_existent_attributes(self):
        @patch('%s.frooble' % builtin_string, sentinel.Frooble, create=True)
        def test():
            self.assertEqual(frooble, sentinel.Frooble)

        test()
        self.assertRaises(NameError, lambda: frooble)


    def test_patchobject_with_create_mocks_non_existent_attributes(self):

3 Source : testpatch.py
with GNU General Public License v3.0
from guohuadeng

    def test_patchobject_with_create_mocks_non_existent_attributes(self):
        @patch.object(SomeClass, 'frooble', sentinel.Frooble, create=True)
        def test():
            self.assertEqual(SomeClass.frooble, sentinel.Frooble)

        test()
        self.assertFalse(hasattr(SomeClass, 'frooble'))


    def test_patch_wont_create_by_default(self):

3 Source : testpatch.py
with GNU General Public License v3.0
from guohuadeng

    def test_patch_wont_create_by_default(self):
        try:
            @patch('%s.frooble' % builtin_string, sentinel.Frooble)
            def test():
                self.assertEqual(frooble, sentinel.Frooble)

            test()
        except AttributeError:
            pass
        else:
            self.fail('Patching non existent attributes should fail')

        self.assertRaises(NameError, lambda: frooble)


    def test_patchobject_wont_create_by_default(self):

3 Source : testpatch.py
with GNU General Public License v3.0
from guohuadeng

    def test_patchobject_wont_create_by_default(self):
        try:
            @patch.object(SomeClass, 'ord', sentinel.Frooble)
            def test():
                self.fail('Patching non existent attributes should fail')

            test()
        except AttributeError:
            pass
        else:
            self.fail('Patching non existent attributes should fail')
        self.assertFalse(hasattr(SomeClass, 'ord'))


    def test_patch_builtins_without_create(self):