Skip to content

Commit def97c9

Browse files
gnpricebenjaminp
authored andcommitted
bpo-37758: Clean out vestigial script-bits from test_unicodedata. (GH-15126)
This file started life as a script, before conversion to a `unittest` test file. Clear out some legacies of that conversion that are a bit confusing about how it works. Most notably, it's unlikely there's still a good reason to try to recover from `unicodedata` failing to import -- as there was when that logic was first added, when the module was very new. So take that out entirely. Keep `self.db` working, though, to avoid a noisy diff.
1 parent 4e3dfcc commit def97c9

File tree

1 file changed

+5
-17
lines changed

1 file changed

+5
-17
lines changed

Lib/test/test_unicodedata.py

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,17 @@
1-
""" Test script for the unicodedata module.
1+
""" Tests for the unicodedata module.
22
33
Written by Marc-Andre Lemburg ([email protected]).
44
55
(c) Copyright CNRI, All Rights Reserved. NO WARRANTY.
66
77
"""
88

9+
import hashlib
910
import sys
11+
import unicodedata
1012
import unittest
11-
import hashlib
1213
from test.support import script_helper
1314

14-
encoding = 'utf-8'
15-
errors = 'surrogatepass'
16-
17-
18-
### Run tests
1915

2016
class UnicodeMethodsTest(unittest.TestCase):
2117

@@ -61,20 +57,12 @@ def test_method_checksum(self):
6157
(char + 'ABC').title(),
6258

6359
]
64-
h.update(''.join(data).encode(encoding, errors))
60+
h.update(''.join(data).encode('utf-8', 'surrogatepass'))
6561
result = h.hexdigest()
6662
self.assertEqual(result, self.expectedchecksum)
6763

6864
class UnicodeDatabaseTest(unittest.TestCase):
69-
70-
def setUp(self):
71-
# In case unicodedata is not available, this will raise an ImportError,
72-
# but the other test cases will still be run
73-
import unicodedata
74-
self.db = unicodedata
75-
76-
def tearDown(self):
77-
del self.db
65+
db = unicodedata
7866

7967
class UnicodeFunctionsTest(UnicodeDatabaseTest):
8068

0 commit comments

Comments
 (0)