def test_get_opening_lzma(): opener = reican.get_opener(test_file_name + ".lzma", stats) with opener("test/test.log.lzma") as logfile: assert len(logfile.readlines()) == 3
def test_opening_plaintext(): opener = reican.get_opener(test_file_name, stats) with opener("test/test.log") as logfile: assert len(logfile.readlines()) == 3
def test_get_opener_lzma_type(): opener = reican.get_opener(test_file_name + ".lzma", stats) assert isinstance(opener, types.FunctionType)
def test_get_opener_lzma_missing(): """Test LZMA opener when LZMA module is missing.""" with mock.patch.dict('sys.modules', {'backports.lzma': None}): with pytest.raises(SystemExit): opener = reican.get_opener(test_file_name + ".lzma", stats) assert isinstance(opener, types.FunctionType)
def test_get_opener_type(): opener = reican.get_opener(test_file_name, stats) assert isinstance(opener, types.BuiltinFunctionType)