File: test_deprecation.py

package info (click to toggle)
python-polyfactory 2.22.2-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,892 kB
  • sloc: python: 11,338; makefile: 103; sh: 37
file content (16 lines) | stat: -rw-r--r-- 510 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
from __future__ import annotations

import pytest

from polyfactory.utils.deprecation import check_for_deprecated_parameters


def test_parameter_deprecation() -> None:
    def my_func(a: int, b: int | None = None) -> None:
        check_for_deprecated_parameters("5", parameters=(("b", b),))

    with pytest.warns(
        DeprecationWarning,
        match="Use of deprecated parameter 'b'. Deprecated in polyfactory 5. This parameter will be removed in the next major version",
    ):
        my_func(1, 2)