jenkins-bot has submitted this change. (
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1305113?usp=email )
Change subject: tests: Improvements for tools_tests.py
......................................................................
tests: Improvements for tools_tests.py
- fix spelling mistakes
- remove duplicate test in TestIsIpAddress
- additional tests for TestIsIpAddress
Change-Id: I960f56f7ed3e7867a684b71effc8ea14438c22e8
---
M tests/tools_tests.py
1 file changed, 19 insertions(+), 13 deletions(-)
Approvals:
jenkins-bot: Verified
Xqt: Looks good to me, approved
diff --git a/tests/tools_tests.py b/tests/tools_tests.py
index 5f3bac0..e3e2edb 100755
--- a/tests/tools_tests.py
+++ b/tests/tools_tests.py
@@ -43,7 +43,7 @@
"""Unit test class for tools.
- The tests for open_archive requires that article-pyrus.xml* contain
+ The tests for open_archive require that article-pyrus.xml* contain
all the same content after extraction. The content itself is not
important. The file article-pyrus.xml_invalid.7z is not a valid 7z
file and open_archive will fail extracting it using 7za.
@@ -71,7 +71,7 @@
self._get_content(self.base_file), self.original_content)
def test_open_archive_bz2(self) -> None:
- """Test open_archive with bz2 compressor in the standard library."""
+ """Test open_archive with bz2 compression in the standard library."""
self.assertEqual(
self._get_content(self.base_file + '.bz2'), self.original_content)
self.assertEqual(
@@ -79,7 +79,7 @@
self.original_content)
def test_open_archive_gz(self) -> None:
- """Test open_archive with gz compressor in the standard library."""
+ """Test open_archive with gz compression in the standard library."""
self.assertEqual(
self._get_content(self.base_file + '.gz'), self.original_content)
@@ -285,7 +285,7 @@
tools.merge_unique_dicts(self.dct1, **self.dct1)
-class TestIsSliceWithEllipsis(TestCase):
+class TestIsliceWithEllipsis(TestCase):
"""Test islice_with_ellipsis."""
@@ -618,7 +618,7 @@
class TestFileModeChecker(TestCase):
- """Test parsing password files."""
+ """Tests for tools.file_mode_checker."""
net = False
@@ -667,7 +667,7 @@
class TestFileShaCalculator(TestCase):
- r"""Test calculator of sha of a file.
+ r"""Test calculator of SHA of a file.
There are two possible hash values for each test. The second one is
for files with Windows line endings (\r\n).
@@ -684,7 +684,7 @@
}
def test_md5_complete_calculation(self) -> None:
- """Test md5 of complete file."""
+ """Test MD5 of complete file."""
for test, sha in self.md5_tests.items():
with self.subTest(test=test):
res = tools.compute_file_hash(self.filename, sha=sha)
@@ -694,7 +694,7 @@
))
def test_md5_partial_calculation(self) -> None:
- """Test md5 of partial file (1024 bytes)."""
+ """Test MD5 of partial file (1024 bytes)."""
for test, sha in self.md5_tests.items():
with self.subTest(test=test):
res = tools.compute_file_hash(self.filename, sha=sha,
@@ -705,7 +705,7 @@
))
def test_sha1_complete_calculation(self) -> None:
- """Test sha1 of complete file."""
+ """Test SHA1 of complete file."""
res = tools.compute_file_hash(self.filename, sha='sha1')
self.assertIn(res, (
'1c12696e1119493a625aa818a35c41916ce32d0c',
@@ -713,7 +713,7 @@
))
def test_sha1_partial_calculation(self) -> None:
- """Test sha1 of partial file (1024 bytes)."""
+ """Test SHA1 of partial file (1024 bytes)."""
res = tools.compute_file_hash(self.filename, sha='sha1',
bytes_to_read=1024)
self.assertIn(res, (
@@ -722,7 +722,7 @@
))
def test_sha224_complete_calculation(self) -> None:
- """Test sha224 of complete file."""
+ """Test SHA224 of complete file."""
res = tools.compute_file_hash(self.filename, sha='sha224')
self.assertIn(res, (
'3d350d9d9eca074bd299cb5ffe1b325a9f589b2bcd7ba1c033ab4d33',
@@ -730,7 +730,7 @@
))
def test_sha224_partial_calculation(self) -> None:
- """Test sha224 of partial file (1024 bytes)."""
+ """Test SHA224 of partial file (1024 bytes)."""
res = tools.compute_file_hash(self.filename, sha='sha224',
bytes_to_read=1024)
self.assertIn(res, (
@@ -841,7 +841,6 @@
valid_addresses = (
'0.0.0.0',
'1.2.3.4',
- '1.2.3.4',
'192.168.0.1',
'255.255.255.255',
)
@@ -856,10 +855,14 @@
None,
'',
'0.0.0',
+ '01.02.03.04',
'1.2.3.256',
'1.2.3.-1',
+ '1.2.3.4.5',
'0.0.0.a',
'a.b.c.d',
+ '192.168.0.1\n',
+ '256.0.0.1',
)
for address in invalid_addresses:
@@ -872,6 +875,7 @@
'fe80:0000:0000:0000:0202:b3ff:fe1e:8329',
'fe80:0:0:0:202:b3ff:fe1e:8329',
'fe80::202:b3ff:fe1e:8329',
+ 'fe80::',
'::ffff:5.9.158.75',
'::',
)
@@ -887,7 +891,9 @@
'',
':',
':::',
+ '::ffff:999.999.999.999',
'2001:db8::aaaa::1',
+ '2001:db8::1::1',
'fe80:0000:0000:0000:0202:b3ff:fe1e: 8329',
'fe80:0000:0000:0000:0202:b3ff:fe1e:829g',
)
--
To view, visit
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1305113?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.wikimedia.org/r/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I960f56f7ed3e7867a684b71effc8ea14438c22e8
Gerrit-Change-Number: 1305113
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
Pywikibot-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]