Clarified error in read_sas method when buffer object provided withou…
…t format

 - [x] closes #14947
 - [x] tests added / passed
 - [X] passes ``git diff upstream/master | flake8 --diff``
 - [X] whatsnew entry

Added three lines to sasreader.py immediately following line 33 (if format==None:) to handle the case when a buffer object is provided without a format='sas7bdat' or format='xport' situation. Method otherwise works splendidly when a filepath is provided, but a buffer object fails. This is an issue when using sasreader directly on SFTP file objects. I am unaware of any bug request (and am happy to open one), but I came across this issue when using the library.
please add a test (you can use ``StringIO()`` as a test buffer) This is my first PR and I don't do much dev--can you expand a bit on the
test you have in mind?

On Dec 21, 2016 17:33, "Jeff Reback" <notifications@github.com> wrote:

> please add a test (you can use StringIO() as a test buffer)
>
> —
> You are receiving this because you authored the thread.
> Reply to this email directly, view it on GitHub
> <https://github.com/pandas-dev/pandas/pull/14947#issuecomment-268661088>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/ABo9lMcvwwYeuxTKQnAGkCU1srG1qdToks5rKakcgaJpZM4LTa7o>
> .
>
 The test should basically be a simplified version of your code that discovered the problem. The test should fail without your fix, and pass with it.

Maybe something like

```python
def test_sas_buffer_format(self):
    b = StringIO("")
    with self.assertRaises(TypeError):
        result = pd.read_sas(b)
```

Haven't tested that, so double check. That can go with the other tests in `pandas/io/tests/sas/test_sas.py` Got it. Much obliged.

On Dec 21, 2016 17:38, "Tom Augspurger" <notifications@github.com> wrote:

> The test should basically be a simplified version of your code that
> discovered the problem. The test should fail without your fix, and pass
> with it.
>
> Maybe something like
>
> def test_sas_buffer_format(self):
>     b = StringIO("")
>     with self.assertRaises(TypeError):
>         result = pd.read_sas(b)
>
> Haven't tested that, so double check. That can go with the other tests in
> pandas/io/tests/sas/test_sas.py
>
> —
> You are receiving this because you authored the thread.
> Reply to this email directly, view it on GitHub
> <https://github.com/pandas-dev/pandas/pull/14947#issuecomment-268662155>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/ABo9lNMXg-se9IxqfkPH07Hk7oCN8DjAks5rKapNgaJpZM4LTa7o>
> .
>
 can you update Updated ## [Current coverage](https://codecov.io/gh/pandas-dev/pandas/pull/14947?src=pr) is 84.75% (diff: 25.00%)
> Merging [#14947](https://codecov.io/gh/pandas-dev/pandas/pull/14947?src=pr) into [master](https://codecov.io/gh/pandas-dev/pandas/branch/master?src=pr) will increase coverage by **0.10%**

```diff
@@             master     #14947   diff @@
==========================================
  Files           144        145     +1   
  Lines         51021      51150   +129   
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
+ Hits          43188      43351   +163   
+ Misses         7833       7799    -34   
  Partials          0          0          
```

> Powered by [Codecov](https://codecov.io?src=pr). Last update [f79bc7a...1285dbb](https://codecov.io/gh/pandas-dev/pandas/compare/f79bc7a9d128187f3a93a3dae84ff03f4f4a62f4...1285dbb1cdb63bb00bc3db50c17db772833b03a9?src=pr) @tomrod travis still reports some PEP8 errors:

```
pandas/io/sas/sasreader.py:6:1: E302 expected 2 blank lines, found 1
pandas/io/tests/sas/test_sas.py:5:1: E302 expected 2 blank lines, found 1
```

(I would recommend setting your IDE to check for this as well) @jorisvandenbossche now passes $ git diff origin | flake8 --diff. Please let me know if you see any more issues.
 thanks!