Skip to content

Commit 9d95112

Browse files
committed
Merge branch 'main' of github.com:pytest-dev/pytest-inline into main
2 parents 14702af + 6d7465d commit 9d95112

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

README.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
pytest-inline is a [pytest](<http://pytest.org>) plugin for writing inline tests.
99

10-
Inline testing is a new granularity of testing that make it easier to check individual program statements. An inline test is a statement that allows to provide arbitrary inputs and test oracles for checking the immediately preceding statement that is not an inline test. Unlike unit tests that are usually placed in separate `test_*.py` files, inline tests are written together with the actual production code (and thus are easier to maintain).
10+
Inline testing is a new granularity of testing that makes it easier to check individual program statements. An inline test is a statement that allows developers to provide arbitrary inputs and test oracles for checking the immediately preceding statement that is not an inline test. Unlike unit tests that are usually placed in separate `test_*.py` files, inline tests are written together with the actual production code (and thus are easier to maintain).
1111

1212
## Table of contents
1313

@@ -19,13 +19,15 @@ Inline testing is a new granularity of testing that make it easier to check indi
1919
6. [Citation](#Citation)
2020

2121
## Example
22-
The regular expression (Line 5) in this code snippet checks if variable name matches a regex for a pattern that ends in a colon and has at least one digit
23-
The inline test (Line 6) that we write for target statement (Line 5) consists of three parts:
22+
The regular expression (Line 7) in this code snippet checks if variable name matches a regex for a pattern that ends in a colon and has at least one digit
23+
The inline test (Line 8) that we write for target statement (Line 7) consists of three parts:
2424
- Declaration with itest() constructor
2525
- Assigning inputs with given() function calls
2626
- Specifying test oracles with check_*() function calls
2727

2828
```python
29+
from inline import itest
30+
2931
def get_assignment_map_from_checkpoint(tvars, init_c):
3032
...
3133
for var in tvars:
@@ -75,9 +77,9 @@ Use ``pytest {filename}`` to run all inline tests in a Python file.
7577

7678
```python {.line-numbers}
7779
def FileHeader(self):
78-
dt = self.date_time
79-
dosdate = (dt[0] - 1980) << 9 | dt[1] << 5 | dt[2]
80-
itest().assume(2 < 4).given(dt, (1980, 1, 25, 17, 13, 14)).check_eq(dosdate, 57)
80+
dt = self.date_time
81+
dosdate = (dt[0] - 1980) << 9 | dt[1] << 5 | dt[2]
82+
itest().assume(2 < 4).given(dt, (1980, 1, 25, 17, 13, 14)).check_eq(dosdate, 57)
8183
```
8284

8385

@@ -87,7 +89,7 @@ Use ``pytest {filename}`` to run all inline tests in a Python file.
8789
- given(variable, value):
8890
Assign the value to the variable.
8991

90-
Note that any number of given statements can be added. Below is a small example of this functionality. Additionally, the first given call must proceed either an itest() declaration or a assume() call if it is added.
92+
Note that any number of given statements can be added. Below is a small example of this functionality. Additionally, the first given call must proceed either an itest() declaration or an assume() call if it is added.
9193

9294
```python {.line-numbers}
9395
def multiple_givens(a, c):

0 commit comments

Comments
 (0)