mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-10 08:38:32 +02:00
update tests
This commit is contained in:
parent
7b5d3fdaf9
commit
d40b013bcd
2 changed files with 9 additions and 5 deletions
|
@ -1,7 +1,9 @@
|
||||||
# Copyright © 2012-2023 jrnl contributors
|
# Copyright © 2012-2023 jrnl contributors
|
||||||
# License: https://www.gnu.org/licenses/gpl-3.0.html
|
# License: https://www.gnu.org/licenses/gpl-3.0.html
|
||||||
from ruamel import yaml
|
from ruamel.yaml import YAML
|
||||||
import sys
|
import sys
|
||||||
|
from io import StringIO
|
||||||
|
|
||||||
|
|
||||||
def run(num=None):
|
def run(num=None):
|
||||||
if num is None:
|
if num is None:
|
||||||
|
@ -9,5 +11,7 @@ def run(num = None):
|
||||||
|
|
||||||
my_str = "a" * int(num)
|
my_str = "a" * int(num)
|
||||||
my_dict = dict(a=my_str, b=dict(c=1, d=2))
|
my_dict = dict(a=my_str, b=dict(c=1, d=2))
|
||||||
return yaml.dump(my_dict)
|
|
||||||
|
|
||||||
|
output = StringIO()
|
||||||
|
YAML().dump(my_dict, output)
|
||||||
|
return output.getvalue()
|
||||||
|
|
|
@ -6,10 +6,10 @@ from jrnl.main import run
|
||||||
|
|
||||||
def test_passes():
|
def test_passes():
|
||||||
num = 80
|
num = 80
|
||||||
assert run(num) == "a: " + ("a" * num) + "\nb: {c: 1, d: 2}\n"
|
assert run(num) == "a: " + ("a" * num) + "\nb:\n c: 1\n d: 2\n"
|
||||||
|
|
||||||
|
|
||||||
def test_fails():
|
def test_fails():
|
||||||
num = 81
|
num = 81
|
||||||
assert run(num) == "a: " + ("a" * num) + "\nb: {c: 1, d: 2}\n"
|
assert run(num) == "a: " + ("a" * num) + "\nb:\n c: 1\n d: 2\n"
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue