Skip to content

Commit 1ab1045

Browse files
committed
TST: Test bz2 non-import works
1 parent 957d043 commit 1ab1045

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

pandas/tests/test_common.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
import numpy as np
88
import pytest
99

10+
sys.modules.pop("bz2", None) # Remove 'bz2' from available modules for testing
11+
from pandas.compat import get_bz2_file
12+
1013
import pandas as pd
1114
from pandas import Series
1215
import pandas._testing as tm
@@ -15,6 +18,13 @@
1518
from pandas.util.version import Version
1619

1720

21+
def test_bz2_nonimport():
22+
assert "bz2" not in sys.modules
23+
msg = "bz2 module not available."
24+
with pytest.raises(RuntimeError, match=msg):
25+
get_bz2_file()
26+
27+
1828
def test_get_callable_name():
1929
getname = com.get_callable_name
2030

0 commit comments

Comments
 (0)