Skip to content

Commit 3c47cf8

Browse files
committed
Remove implementation specific tests
1 parent 5c137bb commit 3c47cf8

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

src/zlib_ng/zlib_ngmodule.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2768,6 +2768,18 @@ PyInit_zlib_ng(void)
27682768
}
27692769
Py_INCREF(ZlibError);
27702770
PyModule_AddObject(m, "error", ZlibError);
2771+
2772+
PyObject *gzip_module = PyImport_ImportModule("gzip");
2773+
if (gzip_module == NULL) {
2774+
return NULL;
2775+
}
2776+
2777+
BadGzipFile = PyObject_GetAttrString(gzip_module, "BadGzipFile");
2778+
if (BadGzipFile == NULL) {
2779+
return NULL;
2780+
}
2781+
Py_INCREF(BadGzipFile);
2782+
27712783
PyModule_AddIntMacro(m, MAX_WBITS);
27722784
PyModule_AddIntMacro(m, DEFLATED);
27732785
PyModule_AddIntMacro(m, DEF_MEM_LEVEL);

tests/test_gzip_compliance.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -613,8 +613,7 @@ def test_read_truncated(self):
613613
with gzip.GzipFile(fileobj=io.BytesIO(truncated)) as f:
614614
self.assertRaises(EOFError, f.read)
615615
with gzip.GzipFile(fileobj=io.BytesIO(truncated)) as f:
616-
self.assertEqual(f.read(len(data)), data)
617-
self.assertRaises(EOFError, f.read, 1)
616+
self.assertRaises(EOFError, f.read)
618617
# Incomplete 10-byte header.
619618
for i in range(2, 10):
620619
with gzip.GzipFile(fileobj=io.BytesIO(truncated[:i])) as f:
@@ -628,13 +627,6 @@ def test_read_with_extra(self):
628627
with gzip.GzipFile(fileobj=io.BytesIO(gzdata)) as f:
629628
self.assertEqual(f.read(), b'Test')
630629

631-
def test_prepend_error(self):
632-
# See issue #20875
633-
with gzip.open(self.filename, "wb") as f:
634-
f.write(data1)
635-
with gzip.open(self.filename, "rb") as f:
636-
f._buffer.raw._fp.prepend()
637-
638630
def test_issue44439(self):
639631
q = array.array('Q', [1, 2, 3, 4, 5])
640632
LENGTH = len(q) * q.itemsize

0 commit comments

Comments
 (0)