File: test_errors_namespace.py

package info (click to toggle)
python-pyvista 0.46.4-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 176,968 kB
  • sloc: python: 94,346; sh: 216; makefile: 70
file content (49 lines) | stat: -rw-r--r-- 1,237 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):
    import pyvista.errors as errors  # noqa: PLR0402

    with pytest.warns(
        PyVistaDeprecationWarning,
        match=rf'now imported as: `from pyvista\.core\.errors import {name}`\.',
    ):
        assert hasattr(errors, name)


@pytest.mark.parametrize(
    'name',
    [
        'InvalidCameraError',
        'RenderWindowUnavailable',
    ],
)
def test_plotting_errors_namespace(name):
    import pyvista.errors as errors  # noqa: PLR0402

    with pytest.warns(
        PyVistaDeprecationWarning,
        match=rf'now imported as: `from pyvista\.plotting\.errors import {name}`\.',
    ):
        assert hasattr(errors, name)