workaround for missing 'assert_called_once' method

this method was introduced in Python 3.6, but calling it still
works (i.e. it doesn't cause the test to fail) on Python 3.3/3.4
pull/30/head
Mike Fährmann 7 years ago
parent 7aa9fa796a
commit 493bd235cf
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

@ -6,4 +6,4 @@
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
__version__ = "0.9.1"
__version__ = "1.0.0-dev"

@ -69,7 +69,7 @@ class TestCookiejar(unittest.TestCase):
with mock.patch.object(log, "warning") as mock_warning:
cookies = extractor.find("test:").session.cookies
self.assertEqual(len(cookies), 0)
mock_warning.assert_called_once()
self.assertEqual(mock_warning.call_count, 1)
self.assertEqual(mock_warning.call_args[0][0], "cookies: %s")
self.assertIsInstance(mock_warning.call_args[0][1], exc)

@ -58,7 +58,7 @@ skip = [
"exhentai", "kissmanga", "mangafox", "dynastyscans", "nijie",
"archivedmoe", "archiveofsins", "thebarchive",
# temporary issues
"twitter",
]
# enable selective testing for direct calls
if __name__ == '__main__' and len(sys.argv) > 1:

Loading…
Cancel
Save