summaryrefslogtreecommitdiff
path: root/devel/py-deprecation/patches/patch-tests_test__deprecation.py
blob: 2c2c70e01b721526d97e31631576cf45d9126c51 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
$NetBSD: patch-tests_test__deprecation.py,v 1.1 2022/01/27 11:35:02 wiz Exp $

Convert from unittest2 to unittest

--- tests/test_deprecation.py.orig	2020-04-20 14:14:19.000000000 +0000
+++ tests/test_deprecation.py
@@ -10,16 +10,14 @@
 # License for the specific language governing permissions and limitations
 # under the License.
 
-# As we unfortunately support Python 2.7, it lacks TestCase.subTest which
-# is in 3.4+ or in unittest2
-import unittest2
+import unittest
 import warnings
 
 import deprecation
 from datetime import date
 
 
-class Test_deprecated(unittest2.TestCase):
+class Test_deprecated(unittest.TestCase):
 
     def test_args_set_on_base_class(self):
         args = (1, 2, 3, 4)
@@ -230,7 +228,7 @@ class Test_deprecated(unittest2.TestCase
             self.assertEqual(sot.method(), ret_val)
 
 
-class Test_fail_if_not_removed(unittest2.TestCase):
+class Test_fail_if_not_removed(unittest.TestCase):
 
     @deprecation.deprecated(deprecated_in="1.0", current_version="2.0")
     def _deprecated_method(self):
@@ -259,7 +257,7 @@ class Test_fail_if_not_removed(unittest2
         except AssertionError:
             self.fail("A DeprecatedWarning shouldn't cause a failure")
 
-    @unittest2.expectedFailure
+    @unittest.expectedFailure
     @deprecation.fail_if_not_removed
     def test_literal_UnsupportedWarning(self):
         self._unsupported_method()