def test_raises_warning_if_file_extension_is_not_cif(self): cif_filepath = "tests/functional/static/valid_cifs/non_cif_extension.txt" # test for warning on validating cif with pytest.warns(UserWarning): validate_cif(cif_filepath) # test for warning on loading cif with pytest.warns(UserWarning): load_cif(cif_filepath)
def test_loading_cif_from_invalid_filepath_raises_exception(self): cif_filepath = "/no/cif/file/here" # test for exception on validating cif with pytest.raises(FileNotFoundError): validate_cif(cif_filepath) # test for exception on loading cif with pytest.raises(FileNotFoundError): load_cif(cif_filepath)
def test_no_exception_and_return_true_with_valid_cif(self, filepath): assert validate_cif(filepath) == True
def test_exception_with_invalid_cif(self, filename, error_message): filepath = "tests/functional/static/invalid_cifs/" + filename with pytest.raises(CIFParseError) as exception_info: validate_cif(filepath) assert str(exception_info.value) == error_message