Skip to content

Commit

Permalink
Reflect changes in v2.1.0 (#5)
Browse files Browse the repository at this point in the history
* Reflect changes from ESSS/pytest-regressions#35

* Run stubtest as part of mypy testenv.

* Updated config files.

* Linting.

* Linting

* Updated files with 'repo_helper'. (#2)

Co-authored-by: repo-helper[bot] <74742576+repo-helper[bot]@users.noreply.github.com>

* [pre-commit.ci] pre-commit autoupdate (#1)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

* Reflect changes from ESSS/pytest-regressions#35

* Linting.

* Don't upload coverage.

* Updated config files.

* Linting.

* Updated config files.

Co-authored-by: repo-helper[bot] <74742576+repo-helper[bot]@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Dec 22, 2020
1 parent 6f8a6cd commit df07824
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 45 deletions.
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ pytest-regressions-stubs
|
.. Installation
.. --------------
Installation
--------------

.. start installation
Expand Down
40 changes: 40 additions & 0 deletions pytest_regressions-stubs/dataframe_regression.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# stdlib
from pathlib import Path
from typing import Any, Dict, Mapping, Optional

# 3rd party
import pandas # type: ignore
from _pytest.fixtures import FixtureRequest


class DataFrameRegressionFixture:
"""
Pandas DataFrame Regression fixture implementation used on dataframe_regression fixture.
"""

DISPLAY_PRECISION: int = 17 # Decimal places
DISPLAY_WIDTH: int = 1000 # Max. Chars on outputs
DISPLAY_MAX_COLUMNS: int = 1000 # Max. Number of columns (see #3)

request: FixtureRequest
datadir: Path
original_datadir: Path
_force_regen: bool
_tolerances_dict: Dict[str, Any]
_default_tolerance: Dict[str, float]
_pandas_display_options: Dict[str, float]

def __init__(self, datadir: Path, original_datadir: Path, request: FixtureRequest): ...
def _check_data_types(self, key: str, obtained_column: pandas.Series, expected_column: pandas.Series) -> None: ...
def _check_data_shapes(self, obtained_column: pandas.Series, expected_column: pandas.Series) -> None: ...
def _check_fn(self, obtained_filename: str, expected_filename: str) -> None: ...
def _dump_fn(self, data_object: pandas.DataFrame, filename: str) -> None: ...

def check(
self,
data_frame: pandas.DataFrame,
basename: Optional[str] = None,
fullpath: Optional[str] = None,
tolerances: Optional[Mapping[str, Any]] = None,
default_tolerance: Optional[Mapping[str, float]] = None,
) -> None: ...
28 changes: 5 additions & 23 deletions pytest_regressions-stubs/num_regression.pyi
Original file line number Diff line number Diff line change
@@ -1,36 +1,18 @@
# stdlib
from pathlib import Path
from typing import Any, Dict, List, Mapping, Optional
from typing import Any, List, Mapping, Optional

# 3rd party
import numpy # type: ignore
import pandas # type: ignore
from _pytest.fixtures import FixtureRequest

# this package
from pytest_regressions.dataframe_regression import DataFrameRegressionFixture

class NumericRegressionFixture:

class NumericRegressionFixture(DataFrameRegressionFixture):
"""
Numeric Data Regression fixture implementation used on num_regression fixture.
"""

DISPLAY_PRECISION: int = 17 # Decimal places
DISPLAY_WIDTH: int = 1000 # Max. Chars on outputs
DISPLAY_MAX_COLUMNS: int = 1000 # Max. Number of columns (see #3)

request: FixtureRequest
datadir: Path
original_datadir: Path
_force_regen: bool
_tolerances_dict: Dict[str, Any]
_default_tolerance: Dict[str, float]
_pandas_display_options: Dict[str, float]

def __init__(self, datadir: Path, original_datadir: Path, request: FixtureRequest): ...
def _check_data_types(self, key: str, obtained_column: pandas.Series, expected_column: pandas.Series) -> None: ...
def _check_data_shapes(self, obtained_column: pandas.Series, expected_column: pandas.Series) -> None: ...
def _check_fn(self, obtained_filename: str, expected_filename: str) -> None: ...
def _dump_fn(self, data_object: pandas.DataFrame, filename: str) -> None: ...

def check(
self,
data_dict: Mapping[str, numpy.ndarray],
Expand Down
4 changes: 4 additions & 0 deletions pytest_regressions-stubs/plugin.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ from _pytest.fixtures import FixtureRequest

# this package
from .data_regression import DataRegressionFixture
from .dataframe_regression import DataFrameRegressionFixture
from .file_regression import FileRegressionFixture
from .num_regression import NumericRegressionFixture
from .image_regression import ImageRegressionFixture
Expand All @@ -25,3 +26,6 @@ def num_regression(datadir: Path, original_datadir: Path, request: FixtureReques

@pytest.fixture
def image_regression(datadir: Path, original_datadir: Path, request: FixtureRequest) -> ImageRegressionFixture: ...

@pytest.fixture
def dataframe_regression(datadir: Path, original_datadir: Path, request: FixtureRequest) -> DataFrameRegressionFixture: ...
20 changes: 0 additions & 20 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -144,26 +144,6 @@ package = pytest_regressions-stubs
addopts = --color yes --durations 25
timeout = 300
[gh-actions]
python =
3.6: py36, build, mypy
3.7: py37, build
3.8: py38, build
[travis]
python =
3.6: py36, build, mypy
3.7: py37, build
3.8: py38, build
[testenv:yapf]
basepython = python3.7
changedir = {toxinidir}
skip_install = True
ignore_errors = True
deps = yapf
commands = yapf -i --recursive pytest_regressions-stubs tests
[testenv:linting]
basepython = python3.7
extras = dev
Expand Down

0 comments on commit df07824

Please sign in to comment.