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
aa3991abc4
commit
7b5d3fdaf9
3 changed files with 18 additions and 9 deletions
10
jrnl/main.py
10
jrnl/main.py
|
@ -1,7 +1,13 @@
|
||||||
# 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 import yaml
|
||||||
|
import sys
|
||||||
|
|
||||||
def run():
|
def run(num = None):
|
||||||
my_dict = dict(a='a' * 80, b=dict(c=1, d=2))
|
if num is None:
|
||||||
|
num = sys.argv[1]
|
||||||
|
|
||||||
|
my_str = "a" * int(num)
|
||||||
|
my_dict = dict(a=my_str, b=dict(c=1, d=2))
|
||||||
return yaml.dump(my_dict)
|
return yaml.dump(my_dict)
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,6 @@ isolated_build = True
|
||||||
deps =
|
deps =
|
||||||
pytest >= 6.2
|
pytest >= 6.2
|
||||||
|
|
||||||
commands = pytest -vvv {posargs}
|
commands = pytest -v {posargs}
|
||||||
passenv = HOME
|
passenv = HOME
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -4,9 +4,12 @@
|
||||||
from jrnl.main import run
|
from jrnl.main import run
|
||||||
|
|
||||||
|
|
||||||
def test_whatever():
|
def test_passes():
|
||||||
expected_output = """
|
num = 80
|
||||||
a: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
assert run(num) == "a: " + ("a" * num) + "\nb: {c: 1, d: 2}\n"
|
||||||
b: {c: 1, d: 2}
|
|
||||||
""".strip()
|
|
||||||
assert run() == expected_output
|
def test_fails():
|
||||||
|
num = 81
|
||||||
|
assert run(num) == "a: " + ("a" * num) + "\nb: {c: 1, d: 2}\n"
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue