Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test Warnings #186

Closed
sadrasabouri opened this issue Mar 30, 2023 · 0 comments · Fixed by #214
Closed

Test Warnings #186

sadrasabouri opened this issue Mar 30, 2023 · 0 comments · Fixed by #214
Assignees
Milestone

Comments

@sadrasabouri
Copy link
Collaborator

Description

There are several warnings when running Samila test. This issue tracker is for solving them.

Steps/Code to Reproduce

python -m pytest --ignore-glob="*nft_upload_test.py" test

Expected Behavior

============================= test session starts ==============================
platform linux -- Python 3.10.6, pytest-7.2.2, pluggy-1.0.0
rootdir: /home/sadra/local/samila, configfile: pytest.ini
plugins: anyio-3.6.2
collected 4 items                                                              

test/error_test.py .                                                                                                                                                                                  [ 25%]
test/function_test.py .                                                                                                                                                                               [ 50%]
test/overall_test.py .                                                                                                                                                                                [ 75%]
test/warning_test.py .                                                                                                                                                                                [100%]

Actual Behavior

============================= test session starts ==============================
platform linux -- Python 3.10.6, pytest-7.2.2, pluggy-1.0.0
rootdir: /home/sadra/local/samila, configfile: pytest.ini
plugins: anyio-3.6.2
collected 4 items                                                              

test/error_test.py .                                                                                                                                                                                  [ 25%]
test/function_test.py .                                                                                                                                                                               [ 50%]
test/overall_test.py .                                                                                                                                                                                [ 75%]
test/warning_test.py .                                                                                                                                                                                [100%]

============================================================================================= warnings summary ==============================================================================================
test/error_test.py::error_test
  /home/sadra/local/samila/samila/params.py:22: MatplotlibDeprecationWarning: The get_cmap function was deprecated in Matplotlib 3.7 and will be removed two minor releases later. Use ``matplotlib.colormaps[name]`` or ``matplotlib.colormaps.get_cmap(obj)`` instead.
    DEFAULT_CMAP = cm.get_cmap("viridis", 256)

test/error_test.py::error_test
test/overall_test.py::overall_test
  /home/sadra/local/samila/samila/genimage.py:100: RuntimeWarning: The given functions are undefined at some points. Your plot may not be complete.
    warn(CALCULATION_EXCEPTION_WARNING, RuntimeWarning)

test/overall_test.py::overall_test
  /home/sadra/local/samila/samila/functions.py:217: RuntimeWarning: color 'rod' not found. Replacing it with 'red'
    warn(

test/overall_test.py::overall_test
  /home/sadra/local/samila/samila/functions.py:217: RuntimeWarning: color 'blacc' not found. Replacing it with 'black'
    warn(

test/overall_test.py::overall_test
  /home/sadra/local/samila/samila/functions.py:161: RuntimeWarning: It is not possible to set color and bgcolor to 'complement' at the same time! Both are automatically set to the previous or default selection.
    warn(BOTH_COLOR_COMPLEMENT_WARNING, RuntimeWarning)

test/overall_test.py::overall_test
test/overall_test.py::overall_test
  /home/sadra/local/samila/samila/functions.py:183: MatplotlibDeprecationWarning: The get_cmap function was deprecated in Matplotlib 3.7 and will be removed two minor releases later. Use ``matplotlib.colormaps[name]`` or ``matplotlib.colormaps.get_cmap(obj)`` instead.
    cmap = cm.get_cmap(cmap.__getattribute__("name"))

test/overall_test.py::overall_test
  /home/sadra/local/samila/samila/functions.py:181: MatplotlibDeprecationWarning: The get_cmap function was deprecated in Matplotlib 3.7 and will be removed two minor releases later. Use ``matplotlib.colormaps[name]`` or ``matplotlib.colormaps.get_cmap(obj)`` instead.
    cmap = cm.get_cmap(cmap, 256)

test/overall_test.py::overall_test
  /home/sadra/local/samila/samila/genimage.py:151: RuntimeWarning: More than 20 figures have been opened. Figures created through the pyplot interface (`matplotlib.pyplot.figure`) are retained until explicitly closed and may consume too much memory. (To control this warning, see the rcParam `figure.max_open_warning`). Consider using `matplotlib.pyplot.close()`.
    fig = plt.figure()

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
================================================================================ 4 passed, 10 warnings in 241.56s (0:04:01) =================================================================================

Operating System

Ubuntu 22.04

Python Version

3.10.6

Samila Version (Use : samila.__version__)

1.0

@sepandhaghighi sepandhaghighi added this to the samila v1.2 milestone Apr 4, 2023
sadrasabouri added a commit that referenced this issue Apr 24, 2023
sepandhaghighi pushed a commit that referenced this issue Apr 30, 2023
* edit : `DEFAULT_CMAP` edited.

* pep8 : autopep8ed.

* change : `DEFAULT_CMAP` -> `DEFAULT_CMAP_NAME`.

* add : `get_cmap` function. (#186)

* remove : extra import form matplotlib.

* log : changes logged.

* add : `# pragma: no cover` added to the `get_cmap` exception.
@sepandhaghighi sepandhaghighi linked a pull request Jun 21, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants