File: test_example_output.py

package info (click to toggle)
junit2html 31.0.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 576 kB
  • sloc: xml: 3,208; python: 1,023; makefile: 6; sh: 5
file content (51 lines) | stat: -rw-r--r-- 893 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
47
48
49
50
51
"""
A series of tests that produce different example output
"""

import sys


def test_stderr_only():
    """
    Print some text to stderr
    :return:
    """
    sys.stderr.write("""
    Hello Standard Error
    =====================================

    This is some formatted stderr
    """)


def test_stdout_only():
    """
    Print some text to stderr
    :return:
    """
    sys.stdout.write("""
    Hello Standard Out
    =====================================

    This is some formatted stdout
    """)


def test_stdoe():
    """
    Print some stuff to stderr and stdout
    :return:
    """
    def err(msg):
        sys.stderr.write(msg)
        sys.stderr.write("\n")

    def out(msg):
        sys.stdout.write(msg)
        sys.stdout.write("\n")

    for _ in range(3):
        for word in ["Hello", "World"]:
            err("Err " + word)
            out("Out " + word)