Skip to content

Commit 7c94aae

Browse files
committed
Split testcases
1 parent 48508f6 commit 7c94aae

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

Lib/test/test_httpservers.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,7 @@ def test_get(self):
539539
finally:
540540
os.chmod(self.tempdir, 0o755)
541541

542-
def test_range_get(self):
542+
def test_single_range_get(self):
543543
route = self.base_url + '/test'
544544
response = self.request(route)
545545
self.assertEqual(response.getheader('accept-ranges'), 'bytes')
@@ -592,13 +592,9 @@ def test_range_get(self):
592592
response = self.request(route, headers={'Range': 'bytes='})
593593
self.check_status_and_reason(response, HTTPStatus.OK, data=self.data)
594594

595-
# multipart ranges (not supported currently)
596-
response = self.request(route, headers={'Range': 'bytes=1-2, 4-7'})
597-
self.check_status_and_reason(response, HTTPStatus.OK, data=self.data)
598-
599-
# empty file
600-
with open(os.path.join(self.tempdir_name, 'empty'), 'wb'):
601-
pass
595+
def test_single_range_get_empty(self):
596+
# range requests to an empty file
597+
os_helper.create_empty_file(os.path.join(self.tempdir_name, 'empty'))
602598
empty_path = self.base_url + '/empty'
603599

604600
response = self.request(empty_path, headers={'Range': 'bytes=0-512'})
@@ -611,6 +607,11 @@ def test_range_get(self):
611607
self.assertEqual(response.getheader('content-range'), 'bytes */0')
612608
self.check_status_and_reason(response, HTTPStatus.REQUESTED_RANGE_NOT_SATISFIABLE)
613609

610+
def test_multi_range_get(self):
611+
# multipart ranges (not supported currently)
612+
response = self.request(self.base_url + '/test', headers={'Range': 'bytes=1-2, 4-7'})
613+
self.check_status_and_reason(response, HTTPStatus.OK, data=self.data)
614+
614615
def test_head(self):
615616
response = self.request(
616617
self.base_url + '/test', method='HEAD')

0 commit comments

Comments
 (0)