test_sas.py 702 B

12345678910111213141516171819202122232425
  1. import pytest
  2. from pandas.compat import StringIO
  3. from pandas import read_sas
  4. import pandas.util.testing as tm
  5. class TestSas(object):
  6. def test_sas_buffer_format(self):
  7. # see gh-14947
  8. b = StringIO("")
  9. msg = ("If this is a buffer object rather than a string "
  10. "name, you must specify a format string")
  11. with pytest.raises(ValueError, match=msg):
  12. read_sas(b)
  13. def test_sas_read_no_format_or_extension(self):
  14. # see gh-24548
  15. msg = ("unable to infer format of SAS file")
  16. with tm.ensure_clean('test_file_no_extension') as path:
  17. with pytest.raises(ValueError, match=msg):
  18. read_sas(path)