diff options
| author | Tim Paine <t.paine154@gmail.com> | 2022-07-23 15:46:43 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-07-23 21:46:43 +0200 |
| commit | 26296c3adc25097ea7f972131bb349ef99f82c6d (patch) | |
| tree | 300577adc4d55dfd43c089eb25f3a533ea9f6fde /tests/testdata/python3 | |
| parent | 5bb3ddef43b35c07485a84f90b6a453fc649e31d (diff) | |
| download | astroid-git-26296c3adc25097ea7f972131bb349ef99f82c6d.tar.gz | |
Fixes #1717 - ignore FutureWarnings which are raised by pandas (#1719)
And probably other modules too.
Diffstat (limited to 'tests/testdata/python3')
| -rw-r--r-- | tests/testdata/python3/data/fake_module_with_warnings.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/testdata/python3/data/fake_module_with_warnings.py b/tests/testdata/python3/data/fake_module_with_warnings.py new file mode 100644 index 00000000..ac818153 --- /dev/null +++ b/tests/testdata/python3/data/fake_module_with_warnings.py @@ -0,0 +1,22 @@ +''' +This is a mock of a module like Pandas, which can throw warnings for deprecated attributes +''' +import warnings + + +def __dir__(): + # GH43028 + # Int64Index etc. are deprecated, but we still want them to be available in the dir. + # Remove in Pandas 2.0, when we remove Int64Index etc. from the code base. + return list(globals().keys()) + ["Float64Index"] + + +def __getattr__(name): + if name == "Float64Index": + warnings.warn("This is what pandas would do", FutureWarning, stacklevel=2) + return 5 + raise AttributeError(f"module 'pandas' has no attribute '{name}'") + + +__all__ = ["Float64Index"] # pylint: disable=E0603 +__doc__ = "" |
