File: test_cont.py

package info (click to toggle)
pytest-codeblocks 0.17.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 180 kB
  • sloc: python: 699; makefile: 34
file content (46 lines) | stat: -rw-r--r-- 861 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
def test_cont(testdir):
    string = """
    Lorem ipsum
    ```python
    a = 1
    ```
    dolor sit amet
    <!--pytest-codeblocks:cont-->
    ```
    a + 1
    ```
    """
    testdir.makefile(".md", string)
    result = testdir.runpytest("--codeblocks")
    result.assert_outcomes(passed=1)


def test_hidden_cont(testdir):
    string = """
    Lorem ipsum
    <!--
    ```python
    a = 1
    ```
    -->
    dolor sit amet
    <!--pytest-codeblocks:cont-->
    ```
    a + 1
    ```
    """
    testdir.makefile(".md", string)
    result = testdir.runpytest("--codeblocks")
    result.assert_outcomes(passed=1)


def test_nocont(testdir):
    string = """
    <!--pytest-codeblocks:cont-->
    ```python
    1 + 2 + 3
    ```
    """
    testdir.makefile(".md", string)
    result = testdir.runpytest("--codeblocks")
    result.assert_outcomes(errors=1)