Remove return values for asserts
State: closed

Unless they are context managers.

- [X] closes #25135 
- [X] tests added / passed (not applicable)
- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [x] whatsnew entry


Labels:
name: Testing
description: pandas testing functions or related to the test suite
name: Clean

Comments:
Looks like a slew of test changes as a result of code like `assert tm.assert_X_equal` which should get updated here.

If you test locally first should make it easier to find up front
OK am hoping to fix the tests shortly. 

# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/25462?src=pr&el=h1) Report
> Merging [#25462](https://codecov.io/gh/pandas-dev/pandas/pull/25462?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/fe1654faa86836a0007bb513504e57c5c9935b8b?src=pr&el=desc) will **decrease** coverage by `50.01%`.
> The diff coverage is `50%`.

[![Impacted file tree graph](https://codecov.io/gh/pandas-dev/pandas/pull/25462/graphs/tree.svg?width=650&token=eZ4WkYLtcO&height=150&src=pr)](https://codecov.io/gh/pandas-dev/pandas/pull/25462?src=pr&el=tree)

```diff
@@             Coverage Diff             @@
##           master   #25462       +/-   ##
===========================================
- Coverage   91.74%   41.72%   -50.02%     
===========================================
  Files         173      173               
  Lines       52923    52922        -1     
===========================================
- Hits        48554    22084    -26470     
- Misses       4369    30838    +26469
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `?` | |
| #single | `41.72% <50%> (-0.01%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/25462?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/util/testing.py](https://codecov.io/gh/pandas-dev/pandas/pull/25462/diff?src=pr&el=tree#diff-cGFuZGFzL3V0aWwvdGVzdGluZy5weQ==) | `51.57% <50%> (-36%)` | :arrow_down: |
| [pandas/io/formats/latex.py](https://codecov.io/gh/pandas-dev/pandas/pull/25462/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL2Zvcm1hdHMvbGF0ZXgucHk=) | `0% <0%> (-100%)` | :arrow_down: |
| [pandas/core/categorical.py](https://codecov.io/gh/pandas-dev/pandas/pull/25462/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvY2F0ZWdvcmljYWwucHk=) | `0% <0%> (-100%)` | :arrow_down: |
| [pandas/io/sas/sas\_constants.py](https://codecov.io/gh/pandas-dev/pandas/pull/25462/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL3Nhcy9zYXNfY29uc3RhbnRzLnB5) | `0% <0%> (-100%)` | :arrow_down: |
| [pandas/tseries/plotting.py](https://codecov.io/gh/pandas-dev/pandas/pull/25462/diff?src=pr&el=tree#diff-cGFuZGFzL3RzZXJpZXMvcGxvdHRpbmcucHk=) | `0% <0%> (-100%)` | :arrow_down: |
| [pandas/tseries/converter.py](https://codecov.io/gh/pandas-dev/pandas/pull/25462/diff?src=pr&el=tree#diff-cGFuZGFzL3RzZXJpZXMvY29udmVydGVyLnB5) | `0% <0%> (-100%)` | :arrow_down: |
| [pandas/io/formats/html.py](https://codecov.io/gh/pandas-dev/pandas/pull/25462/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL2Zvcm1hdHMvaHRtbC5weQ==) | `0% <0%> (-99.35%)` | :arrow_down: |
| [pandas/core/groupby/categorical.py](https://codecov.io/gh/pandas-dev/pandas/pull/25462/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZ3JvdXBieS9jYXRlZ29yaWNhbC5weQ==) | `0% <0%> (-95.46%)` | :arrow_down: |
| [pandas/io/sas/sas7bdat.py](https://codecov.io/gh/pandas-dev/pandas/pull/25462/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL3Nhcy9zYXM3YmRhdC5weQ==) | `0% <0%> (-91.17%)` | :arrow_down: |
| [pandas/io/sas/sas\_xport.py](https://codecov.io/gh/pandas-dev/pandas/pull/25462/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL3Nhcy9zYXNfeHBvcnQucHk=) | `0% <0%> (-90.15%)` | :arrow_down: |
| ... and [131 more](https://codecov.io/gh/pandas-dev/pandas/pull/25462/diff?src=pr&el=tree-more) | |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/25462?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/25462?src=pr&el=footer). Last update [fe1654f...220052a](https://codecov.io/gh/pandas-dev/pandas/pull/25462?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/25462?src=pr&el=h1) Report
> Merging [#25462](https://codecov.io/gh/pandas-dev/pandas/pull/25462?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/94c8c94dccfa7934699c314420f0898d81425519?src=pr&el=desc) will **decrease** coverage by `<.01%`.
> The diff coverage is `100%`.

[![Impacted file tree graph](https://codecov.io/gh/pandas-dev/pandas/pull/25462/graphs/tree.svg?width=650&token=eZ4WkYLtcO&height=150&src=pr)](https://codecov.io/gh/pandas-dev/pandas/pull/25462?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master   #25462      +/-   ##
==========================================
- Coverage   91.98%   91.98%   -0.01%     
==========================================
  Files         175      175              
  Lines       52374    52373       -1     
==========================================
- Hits        48178    48173       -5     
- Misses       4196     4200       +4
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.53% <100%> (-0.01%)` | :arrow_down: |
| #single | `40.72% <44.44%> (-0.15%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/25462?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/util/testing.py](https://codecov.io/gh/pandas-dev/pandas/pull/25462/diff?src=pr&el=tree#diff-cGFuZGFzL3V0aWwvdGVzdGluZy5weQ==) | `90.6% <100%> (-0.01%)` | :arrow_down: |
| [pandas/io/gbq.py](https://codecov.io/gh/pandas-dev/pandas/pull/25462/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL2dicS5weQ==) | `78.94% <0%> (-10.53%)` | :arrow_down: |
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/25462/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `96.9% <0%> (-0.12%)` | :arrow_down: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/25462?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/25462?src=pr&el=footer). Last update [94c8c94...f4497fd](https://codecov.io/gh/pandas-dev/pandas/pull/25462?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

@samuelsinayoko : This looks much better!  I still see a handful of `return assert_*` statements in that file (`assert_almost_equal` and `assert_series_equal` implementations contain the remainder).  Can those be removed as well?
> @samuelsinayoko : This looks much better! I still see a handful of `return assert_*` statements in that file (`assert_almost_equal` and `assert_series_equal` implementations contain the remainder). Can those be removed as well?

done in 60ec5ee
@samuelsinayoko : I think you only removed the ones in `assert_almost_equal`.  There are still two in `assert_series_equal`.  Were you able to remove those?
Ha sorry! Will update the PR today.

Sent from my iPhone

> On 4 Mar 2019, at 08:48, gfyoung <notifications@github.com> wrote:
> 
> @samuelsinayoko : I think you only removed the ones in assert_almost_equal. There are still two in assert_series_equal. Were you able to remove those?
> 
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub, or mute the thread.

can you merge master and update
@jreback have merged master and updated the branch. Don't think I can leave out the return statements as you suggested because that breaks the buil (search back for the build of 091a00e2 above)
@samuelsinayoko you may need to fix some tests that are actually asserting the result of this assert, but I want to remove the return values
OK I'll give this another go.

On Tue, 26 Mar 2019 at 11:52, Jeff Reback <notifications@github.com> wrote:

> @samuelsinayoko <https://github.com/samuelsinayoko> you may need to fix
> some tests that are actually asserting the result of this assert, but I
> want to remove the return values
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub
> <https://github.com/pandas-dev/pandas/pull/25462#issuecomment-476592213>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/AQuwvoIm4H69yV_3a7pOHtrxIzmje36Rks5vagntgaJpZM4bVN-a>
> .
>


-- 

*Sam Sinayoko* | Data Scientist

*BMLL Technologies Ltd.*

10th Floor – Portland House

Bressenden Place

London

SW1E 5RS

+44(0)20 3828 9020

can you merge master and update
Apologies, haven't found the time to come back to this as work's been crazy
for  the past couple of weeks but will update the PR over the weekend.

On Fri, 5 Apr 2019 at 01:51, Jeff Reback <notifications@github.com> wrote:

> can you merge master and update
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub
> <https://github.com/pandas-dev/pandas/pull/25462#issuecomment-480112813>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/AQuwvuUm4RYJbZPrU-0idZAykUR1dzw5ks5vdp4SgaJpZM4bVN-a>
> .
>


-- 

*Sam Sinayoko* | Data Scientist

*BMLL Technologies Ltd.*

10th Floor – Portland House

Bressenden Place

London

SW1E 5RS

+44(0)20 3828 9020

can you merge master
Can you merge and fix up conflicts with master? I think this will be a precursor to #26234 
Sure. Will do tonight.

Sent from my iPhone

> On 30 Apr 2019, at 02:45, William Ayd <notifications@github.com> wrote:
> 
> Can you merge and fix up conflicts with master? I think this will be a precursor to #26234
> 
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub, or mute the thread.

not exactly sure why, but this surfaced an error in our tests

pushed a patch, let's see
Looks like a test failure in pandas/tests/io/parser/test_textreader.py which is inadvertently expecting a return value from one of the assert functions; if you can take a look
Will do.

On Wed, 1 May 2019 at 15:06, William Ayd <notifications@github.com> wrote:

> Looks like a test failure in pandas/tests/io/parser/test_textreader.py
> which is inadvertently expecting a return value from one of the assert
> functions; if you can take a look
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub
> <https://github.com/pandas-dev/pandas/pull/25462#issuecomment-488291236>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/AEF3BPWUZSFDCWFM75YBYH3PTGPWNANCNFSM4G2U36NA>
> .
>


-- 

*Sam Sinayoko* | Data Scientist

*BMLL Technologies Ltd.*

10th Floor – Portland House

Bressenden Place

London

SW1E 5RS

+44(0)20 3828 9020

i pushed again, let's see

@WillAyd I think we would get a lot of mileage out of typing these assert_* functions, can you create an issue 
thanks for the patch @samuelsinayoko 
@jreback sounds good, though I was actually thinking we'd almost always ignore `pandas/tests` from static analysis. 

In any case opened #26302 so can discuss there as needed