You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: doc/en/explanation/types.rst
+9-13
Original file line number
Diff line number
Diff line change
@@ -1,10 +1,12 @@
1
1
.. _types:
2
2
3
-
Enhancing Type Annotations with Pytest
4
-
======================================
3
+
Typing in pytest
4
+
================
5
5
6
-
This page assumes the reader is familiar with Python's typing system and its advantages.
7
-
For more information, refer to `Python's Typing Documentation <https://docs.python.org/3/library/typing.html>`_.
6
+
.. note::
7
+
This page assumes the reader is familiar with Python's typing system and its advantages.
8
+
9
+
For more information, refer to `Python's Typing Documentation <https://docs.python.org/3/library/typing.html>`_.
8
10
9
11
Why type tests?
10
12
---------------
@@ -37,8 +39,8 @@ Note the code above has 100% coverage, but the bug is not caught (of course the
37
39
38
40
39
41
40
-
Typing fixtures
41
-
---------------
42
+
Using typing in test suites
43
+
---------------------------
42
44
43
45
To type fixtures in pytest, just add normal types to the fixture functions -- there is nothing special that needs to be done just because of the `fixture` decorator.
44
46
@@ -61,20 +63,16 @@ In the same manner, the fixtures passed to test functions need be annotated with
61
63
From the POV of the type checker, it does not matter that `sample_fixture` is actually a fixture managed by pytest, all it matters to it is that `sample_fixture` is a parameter of type `int`.
62
64
63
65
64
-
The same logic applies to `@pytest.mark.parametrize`:
66
+
The same logic applies to :ref:`@pytest.mark.parametrize<@pytest.mark.parametrize>`:
0 commit comments