MAINT: Fix Python version dependent test.

The buffer test in numpy/core/tests/test_api.py was apparently
testing for incorrect behavior that was corrected in Python 2.7.5.
This PR changes the test to check for the correct results and makes
running it depend on Python version.

Closes #3512.
Merge pull request #3522 from charris/fix-test_api

MAINT: Fix Python version dependent test.
Merge pull request #3520 from charris/replace-warningmanager

Replace use of WarningManager by warnings.catch_warnings and then deprecate it.
ENH: Adding np.nanmean(), np.nanstd(), np.nanvar()
TST: Added tests for nanmean(), nanvar(), nanstd()
MAINT: Separate nan functions into their own module.

New files lib/nanfunctions.py and lib/tests/test_nanfunctions.py are
added and both the previous and new nan functions and tests are moved
into them.

The existing nan functions moved from lib/function_base are:

    nansum, nanmin, nanmax, nanargmin, nanargmax

The added nan functions moved from core/numeric are:

    nanmean, nanvar, nanstd
MAINT: Clean up core/_methods.py and core/fromnumeric.py

Use issubclass instead of issubdtype.
Add some blank lines.
Remove trailing whitespace.
Remove uneeded float casts since true_divide is default.
Clean up documentation a bit.
BUG: Make mean, sum, var, std methods return correct scalar type.

The return type could differ depending on whether or not the value
was a scalar.
ENH: Make var and std methods raise error when ddof too big.

Currently the results may be infinite or negative. Instead, raise a
ValueError in this case.
TST: Add more extensive tests for the mean, var, and std methods.

Test the mean, var, and std methods more extensively. In addition, add
tests that:

    Check that scalar return types ar what they should be.
    Check that ValueError is raised when ddof is too big.
MAINT: Refactor nanfunctions.

nanmax, nanmin
--------------
Add out and keepdims keywords.

nanargmin, nanargmax
--------------------
A NanWarning is raised if an all NaN slice detected. For all such
slices np.iingo(np.intp).min is returned as the index value.

nansum
------
The keywords dtype, out, and keepdims are added.

A FutureWarning is raised, as in the future the mean of an empty
slice after NaN replacement will be 0 instead of the current NaN.

nanmean, nanvar, nanstd
-----------------------
For all, if the input array is of inexact type then the dtype and out
parameters must be of inexact type if specified.  That insures that NaNs
can be returned when appropriate.

The nanmean function detects empty slices after NaN replacement and
raises a NanWarning. NaN is returned as the value for all such slices.

The nanmean and nanstd functions detect degrees of freedom <= 0 after
NaN replacement and raise a NanWarning. NaN is returned as the value for
all such slices.
TST: Add tests for the nansum, nanmean, nanvar, and nanstd.
DOC: Document nanmean, nanvar, and nanstd in the 1.8.0 release notes.
BUG: Regression test needs to ignore ComplexWarning.

This was raising a warning during tests.