Esempio n. 1
0
def test_kwargs_overrule_file_params(sas_source_file: SourceFile):
    """Adding encoding='iso8859' as a kwarg to get_sas_as_df, should
    overrule the original encoding value in the SourceFile's params."""
    assert sas_source_file._params['encoding'] == 'utf-8'
    with pytest.raises(UnicodeDecodeError):
        sas_source_file.get_sas_as_df(apply_dtypes=False)
    df = sas_source_file.get_sas_as_df(apply_dtypes=False, encoding='iso8859')
    assert df.shape == (30, 5)
Esempio n. 2
0
def test_sas_requires_encoding_param(sas_source_file: SourceFile):
    del sas_source_file._params['encoding']
    with pytest.raises(ValueError) as excinfo:
        sas_source_file.get_sas_as_df(apply_dtypes=False)
    assert "encoding" in str(excinfo.value)