|
1 | 1 | # stdlib
|
2 | 2 | import json
|
3 | 3 | import os
|
| 4 | +import re |
4 | 5 | import sys
|
5 | 6 |
|
6 | 7 | # 3rd party
|
@@ -146,22 +147,21 @@ def test_echo(capsys):
|
146 | 147 | employer = fake.company()
|
147 | 148 | telephone = fake.phone_number()
|
148 | 149 | alive = fake.pybool()
|
149 |
| - other = fake.pydict() |
| 150 | + z_other = fake.pydict() |
150 | 151 |
|
151 | 152 | captured = capsys.readouterr()
|
152 | 153 | stdout = captured.out.split("\n")
|
153 |
| - print(stdout) |
154 | 154 |
|
155 | 155 | assert stdout[0] == " {{'address': '{}',".format(address.replace("\n", "\\n"))
|
156 | 156 | assert stdout[1] == f" 'alive': {alive},"
|
157 | 157 | assert stdout[2] == f" 'employer': '{employer}',"
|
158 | 158 | assert stdout[3] == f" 'iban': '{iban}',"
|
159 | 159 | assert stdout[4] == f" 'ip_address': '{ip_address}',"
|
160 | 160 | assert stdout[5] == f" 'name': '{name}',"
|
161 |
| - assert stdout[6].startswith(" 'other': {") |
162 |
| - assert stdout[6].endswith(",") |
163 |
| - for line in range(7, 13, 1): |
164 |
| - assert stdout[line].startswith(" '") |
165 |
| - assert stdout[line].endswith(",") |
166 |
| - assert stdout[-2] == f" 'telephone': '{telephone}'}}" |
| 161 | + assert stdout[6] == f" 'telephone': '{telephone}'," |
| 162 | + assert stdout[7].startswith(" 'z_other': {") |
| 163 | + assert stdout[7].endswith(",") |
| 164 | + for line in range(8, 13, 1): |
| 165 | + assert re.match(r"^\s*'.*':.*[,}]$", stdout[line]) |
| 166 | + assert stdout[-2].endswith("}") |
167 | 167 | assert stdout[-1] == ''
|
0 commit comments