Python mock.sentinel.SomethingElse() Examples

The following are 12 code examples of mock.sentinel.SomethingElse(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module mock.sentinel , or try the search function .
Example #1
Source File: testwith.py    From auto-alt-text-lambda-api with MIT License 5 votes vote down vote up
def test_with_statement_nested(self):
        with catch_warnings(record=True):
            with patch('%s.something' % __name__) as mock_something:
                with patch('%s.something_else' % __name__) as mock_something_else:
                    self.assertEqual(something, mock_something, "unpatched")
                    self.assertEqual(something_else, mock_something_else,
                                     "unpatched")

        self.assertEqual(something, sentinel.Something)
        self.assertEqual(something_else, sentinel.SomethingElse) 
Example #2
Source File: testwith.py    From auto-alt-text-lambda-api with MIT License 5 votes vote down vote up
def test_with_statement_imbricated(self):
        with patch('%s.something' % __name__) as mock_something:
            self.assertEqual(something, mock_something, "unpatched")

            with patch('%s.something_else' % __name__) as mock_something_else:
                self.assertEqual(something_else, mock_something_else,
                                 "unpatched")

        self.assertEqual(something, sentinel.Something)
        self.assertEqual(something_else, sentinel.SomethingElse) 
Example #3
Source File: testwith.py    From mock with BSD 2-Clause "Simplified" License 5 votes vote down vote up
def test_with_statement_nested(self):
        with catch_warnings(record=True):
            with patch('%s.something' % __name__) as mock_something, patch('%s.something_else' % __name__) as mock_something_else:
                self.assertEqual(something, mock_something, "unpatched")
                self.assertEqual(something_else, mock_something_else,
                                 "unpatched")

        self.assertEqual(something, sentinel.Something)
        self.assertEqual(something_else, sentinel.SomethingElse) 
Example #4
Source File: testwith.py    From mock with BSD 2-Clause "Simplified" License 5 votes vote down vote up
def test_with_statement_imbricated(self):
        with patch('%s.something' % __name__) as mock_something:
            self.assertEqual(something, mock_something, "unpatched")

            with patch('%s.something_else' % __name__) as mock_something_else:
                self.assertEqual(something_else, mock_something_else,
                                 "unpatched")

        self.assertEqual(something, sentinel.Something)
        self.assertEqual(something_else, sentinel.SomethingElse) 
Example #5
Source File: testwith.py    From ImageFusion with MIT License 5 votes vote down vote up
def test_with_statement_nested(self):
        with catch_warnings(record=True):
            with patch('%s.something' % __name__) as mock_something:
                with patch('%s.something_else' % __name__) as mock_something_else:
                    self.assertEqual(something, mock_something, "unpatched")
                    self.assertEqual(something_else, mock_something_else,
                                     "unpatched")

        self.assertEqual(something, sentinel.Something)
        self.assertEqual(something_else, sentinel.SomethingElse) 
Example #6
Source File: testwith.py    From ImageFusion with MIT License 5 votes vote down vote up
def test_with_statement_imbricated(self):
        with patch('%s.something' % __name__) as mock_something:
            self.assertEqual(something, mock_something, "unpatched")

            with patch('%s.something_else' % __name__) as mock_something_else:
                self.assertEqual(something_else, mock_something_else,
                                 "unpatched")

        self.assertEqual(something, sentinel.Something)
        self.assertEqual(something_else, sentinel.SomethingElse) 
Example #7
Source File: testwith.py    From odoo13-x64 with GNU General Public License v3.0 5 votes vote down vote up
def test_with_statement_nested(self):
        with catch_warnings(record=True):
            with patch('%s.something' % __name__) as mock_something:
                with patch('%s.something_else' % __name__) as mock_something_else:
                    self.assertEqual(something, mock_something, "unpatched")
                    self.assertEqual(something_else, mock_something_else,
                                     "unpatched")

        self.assertEqual(something, sentinel.Something)
        self.assertEqual(something_else, sentinel.SomethingElse) 
Example #8
Source File: testwith.py    From odoo13-x64 with GNU General Public License v3.0 5 votes vote down vote up
def test_with_statement_imbricated(self):
        with patch('%s.something' % __name__) as mock_something:
            self.assertEqual(something, mock_something, "unpatched")

            with patch('%s.something_else' % __name__) as mock_something_else:
                self.assertEqual(something_else, mock_something_else,
                                 "unpatched")

        self.assertEqual(something, sentinel.Something)
        self.assertEqual(something_else, sentinel.SomethingElse) 
Example #9
Source File: testwith.py    From keras-lambda with MIT License 5 votes vote down vote up
def test_with_statement_nested(self):
        with catch_warnings(record=True):
            with patch('%s.something' % __name__) as mock_something:
                with patch('%s.something_else' % __name__) as mock_something_else:
                    self.assertEqual(something, mock_something, "unpatched")
                    self.assertEqual(something_else, mock_something_else,
                                     "unpatched")

        self.assertEqual(something, sentinel.Something)
        self.assertEqual(something_else, sentinel.SomethingElse) 
Example #10
Source File: testwith.py    From keras-lambda with MIT License 5 votes vote down vote up
def test_with_statement_imbricated(self):
        with patch('%s.something' % __name__) as mock_something:
            self.assertEqual(something, mock_something, "unpatched")

            with patch('%s.something_else' % __name__) as mock_something_else:
                self.assertEqual(something_else, mock_something_else,
                                 "unpatched")

        self.assertEqual(something, sentinel.Something)
        self.assertEqual(something_else, sentinel.SomethingElse) 
Example #11
Source File: testwith.py    From odoo12-x64 with GNU General Public License v3.0 5 votes vote down vote up
def test_with_statement_nested(self):
        with catch_warnings(record=True):
            with patch('%s.something' % __name__) as mock_something:
                with patch('%s.something_else' % __name__) as mock_something_else:
                    self.assertEqual(something, mock_something, "unpatched")
                    self.assertEqual(something_else, mock_something_else,
                                     "unpatched")

        self.assertEqual(something, sentinel.Something)
        self.assertEqual(something_else, sentinel.SomethingElse) 
Example #12
Source File: testwith.py    From odoo12-x64 with GNU General Public License v3.0 5 votes vote down vote up
def test_with_statement_imbricated(self):
        with patch('%s.something' % __name__) as mock_something:
            self.assertEqual(something, mock_something, "unpatched")

            with patch('%s.something_else' % __name__) as mock_something_else:
                self.assertEqual(something_else, mock_something_else,
                                 "unpatched")

        self.assertEqual(something, sentinel.Something)
        self.assertEqual(something_else, sentinel.SomethingElse)