mirror of
https://github.com/python/cpython.git
synced 2025-11-02 11:08:57 +00:00
Replace catch_warnings with check_warnings when it makes sense. Use assertRaises context manager to simplify some tests.
This commit is contained in:
parent
ad59833649
commit
6257a7bbb2
21 changed files with 112 additions and 226 deletions
|
|
@ -1,13 +1,9 @@
|
|||
# Simple test suite for Cookie.py
|
||||
|
||||
from test.test_support import run_unittest, run_doctest
|
||||
from test.test_support import run_unittest, run_doctest, check_warnings
|
||||
import unittest
|
||||
import Cookie
|
||||
|
||||
import warnings
|
||||
warnings.filterwarnings("ignore",
|
||||
".* class is insecure.*",
|
||||
DeprecationWarning)
|
||||
|
||||
class CookieTests(unittest.TestCase):
|
||||
# Currently this only tests SimpleCookie
|
||||
|
|
@ -76,7 +72,9 @@ class CookieTests(unittest.TestCase):
|
|||
|
||||
def test_main():
|
||||
run_unittest(CookieTests)
|
||||
run_doctest(Cookie)
|
||||
with check_warnings(('.+Cookie class is insecure; do not use it',
|
||||
DeprecationWarning)):
|
||||
run_doctest(Cookie)
|
||||
|
||||
if __name__ == '__main__':
|
||||
test_main()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue