File: test_errors_namespace.py

package info (click to toggle)
python-pyvista 0.44.1-11
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 159,804 kB
  • sloc: python: 72,164; sh: 118; makefile: 68
file content (49 lines) | stat: -rw-r--r-- 1,245 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
from __future__ import annotations

import pytest

from pyvista.core.errors import PyVistaDeprecationWarning


@pytest.mark.parametrize(
    'name',
    [
        'AmbiguousDataError',
        'DeprecationError',
        'MissingDataError',
        'NotAllTrianglesError',
        'PointSetCellOperationError',
        'PointSetDimensionReductionError',
        'PointSetNotSupported',
        'PyVistaDeprecationWarning',
        'PyVistaEfficiencyWarning',
        'PyVistaFutureWarning',
        'PyVistaPipelineError',
        'VTKVersionError',
    ],
)
def test_core_errors_namespace(name):
    with pytest.warns(
        PyVistaDeprecationWarning,
        match=rf'now imported as: `from pyvista\.core\.errors import {name}`\.',
    ):
        import pyvista.errors as errors  # noqa: PLR0402

        assert hasattr(errors, name)


@pytest.mark.parametrize(
    'name',
    [
        'InvalidCameraError',
        'RenderWindowUnavailable',
    ],
)
def test_plotting_errors_namespace(name):
    with pytest.warns(
        PyVistaDeprecationWarning,
        match=rf'now imported as: `from pyvista\.plotting\.errors import {name}`\.',
    ):
        import pyvista.errors as errors  # noqa: PLR0402

        assert hasattr(errors, name)