codeplain 0.3.13.dev47__py3-none-any.whl → 0.3.13.dev49__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {codeplain-0.3.13.dev47.dist-info → codeplain-0.3.13.dev49.dist-info}/METADATA +2 -2
- {codeplain-0.3.13.dev47.dist-info → codeplain-0.3.13.dev49.dist-info}/RECORD +16 -19
- concept_utils.py +2 -220
- file_utils.py +6 -106
- plain2code.py +38 -5
- plain2code_exceptions.py +12 -42
- plain2code_nodes.py +2 -118
- plain2code_utils.py +1 -16
- plain_file.py +2 -870
- plain_spec.py +9 -413
- tests/test_file_utils.py +1 -70
- tests/test_render_range.py +42 -0
- tests/test_user_error_message.py +36 -0
- tests/test_imports.py +0 -53
- tests/test_plainfile.py +0 -271
- tests/test_plainfileparser.py +0 -775
- tests/test_plainspec.py +0 -103
- tests/test_requires.py +0 -28
- {codeplain-0.3.13.dev47.dist-info → codeplain-0.3.13.dev49.dist-info}/WHEEL +0 -0
- {codeplain-0.3.13.dev47.dist-info → codeplain-0.3.13.dev49.dist-info}/entry_points.txt +0 -0
- {codeplain-0.3.13.dev47.dist-info → codeplain-0.3.13.dev49.dist-info}/licenses/LICENSE +0 -0
tests/test_plainspec.py
DELETED
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import pytest
|
|
2
|
-
|
|
3
|
-
import plain_file
|
|
4
|
-
import plain_spec
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
def test_get_linked_resources_invalid_input():
|
|
8
|
-
with pytest.raises(ValueError, match="plain_source_tree must be a dictionary."):
|
|
9
|
-
plain_spec.collect_linked_resources([], [], None, True)
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
def test_has_acceptance_tests_true():
|
|
13
|
-
plain_source = {
|
|
14
|
-
plain_spec.FUNCTIONAL_REQUIREMENTS: [
|
|
15
|
-
{"markdown": "- First functionality."},
|
|
16
|
-
{
|
|
17
|
-
"markdown": "- Second functionality.",
|
|
18
|
-
plain_spec.ACCEPTANCE_TESTS: [{"markdown": "- Test the second functionality."}],
|
|
19
|
-
},
|
|
20
|
-
]
|
|
21
|
-
}
|
|
22
|
-
assert plain_spec.has_acceptance_tests(plain_source) is True
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
def test_has_acceptance_tests_false_when_no_acceptance_tests():
|
|
26
|
-
plain_source = {
|
|
27
|
-
plain_spec.FUNCTIONAL_REQUIREMENTS: [
|
|
28
|
-
{"markdown": "- First functionality."},
|
|
29
|
-
{"markdown": "- Second functionality."},
|
|
30
|
-
]
|
|
31
|
-
}
|
|
32
|
-
assert plain_spec.has_acceptance_tests(plain_source) is False
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
def test_has_acceptance_tests_false_when_empty_acceptance_tests():
|
|
36
|
-
plain_source = {
|
|
37
|
-
plain_spec.FUNCTIONAL_REQUIREMENTS: [
|
|
38
|
-
{"markdown": "- First functionality.", plain_spec.ACCEPTANCE_TESTS: []},
|
|
39
|
-
]
|
|
40
|
-
}
|
|
41
|
-
assert plain_spec.has_acceptance_tests(plain_source) is False
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
def test_has_acceptance_tests_false_when_no_functional_requirements():
|
|
45
|
-
assert plain_spec.has_acceptance_tests({}) is False
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
def test_get_frids_simple(get_test_data_path):
|
|
49
|
-
_, plain_source, _ = plain_file.plain_file_parser("simple.plain", [get_test_data_path("data/")])
|
|
50
|
-
|
|
51
|
-
frids = list(plain_spec.get_frids(plain_source))
|
|
52
|
-
|
|
53
|
-
assert frids == ["1"]
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
def test_get_first_functional_requirement_simple(get_test_data_path):
|
|
57
|
-
_, plain_source, _ = plain_file.plain_file_parser("simple.plain", [get_test_data_path("data/")])
|
|
58
|
-
|
|
59
|
-
assert plain_spec.get_first_frid(plain_source) == "1"
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
def test_get_next_frid_not_exists(get_test_data_path):
|
|
63
|
-
_, plain_source, _ = plain_file.plain_file_parser("simple.plain", [get_test_data_path("data/")])
|
|
64
|
-
|
|
65
|
-
with pytest.raises(Exception, match="Functionality 2 does not exist."):
|
|
66
|
-
plain_spec.get_next_frid(plain_source, "2")
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
def test_get_next_frid_simple(get_test_data_path):
|
|
70
|
-
_, plain_source, _ = plain_file.plain_file_parser("simple.plain", [get_test_data_path("data/")])
|
|
71
|
-
|
|
72
|
-
assert plain_spec.get_next_frid(plain_source, "1") is None
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
def test_get_previous_frid_not_exists(get_test_data_path):
|
|
76
|
-
_, plain_source, _ = plain_file.plain_file_parser("simple.plain", [get_test_data_path("data/")])
|
|
77
|
-
|
|
78
|
-
with pytest.raises(Exception, match="Functionality 2 does not exist."):
|
|
79
|
-
plain_spec.get_previous_frid(plain_source, "2")
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
def test_get_previous_frid_no_previous_frid(get_test_data_path):
|
|
83
|
-
_, plain_source, _ = plain_file.plain_file_parser("simple.plain", [get_test_data_path("data/")])
|
|
84
|
-
|
|
85
|
-
assert plain_spec.get_previous_frid(plain_source, "1") is None
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
def test_get_specifications_simple(get_test_data_path):
|
|
89
|
-
_, plain_source, _ = plain_file.plain_file_parser("simple.plain", [get_test_data_path("data/")])
|
|
90
|
-
|
|
91
|
-
with pytest.raises(Exception, match="Functionality a does not exist."):
|
|
92
|
-
plain_spec.get_specifications_for_frid(plain_source, "a")
|
|
93
|
-
|
|
94
|
-
frid = plain_spec.get_first_frid(plain_source)
|
|
95
|
-
|
|
96
|
-
specifications, _ = plain_spec.get_specifications_for_frid(plain_source, frid)
|
|
97
|
-
|
|
98
|
-
assert specifications == {
|
|
99
|
-
"definitions": [],
|
|
100
|
-
"implementation reqs": ["- Simple implementation requirement"],
|
|
101
|
-
"test reqs": [],
|
|
102
|
-
"functional specs": ["- Simple functionality"],
|
|
103
|
-
}
|
tests/test_requires.py
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import pytest
|
|
2
|
-
|
|
3
|
-
import plain_file
|
|
4
|
-
from plain2code_exceptions import ModuleDoesNotExistError
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
def test_non_existent_require(get_test_data_path):
|
|
8
|
-
with pytest.raises(ModuleDoesNotExistError, match="Module does not exist"):
|
|
9
|
-
plain_file.plain_file_parser("non_existent_require.plain", [get_test_data_path("data/requires")])
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
def test_independent_requires(get_test_data_path):
|
|
13
|
-
with pytest.raises(Exception, match="There must be a fixed order how required modules are dependent"):
|
|
14
|
-
plain_file.plain_file_parser("independent_requires_main.plain", [get_test_data_path("data/requires")])
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
def test_diamond_requires(get_test_data_path):
|
|
18
|
-
with pytest.raises(Exception, match="There must be a fixed order how required modules are dependent"):
|
|
19
|
-
plain_file.plain_file_parser("diamond_requires_main.plain", [get_test_data_path("data/requires")])
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
def test_circular_requires(get_test_data_path):
|
|
23
|
-
with pytest.raises(Exception, match="Circular required module detected"):
|
|
24
|
-
plain_file.plain_file_parser("circular_requires_main.plain", [get_test_data_path("data/requires")])
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
def test_normal_requires(get_test_data_path):
|
|
28
|
-
plain_file.plain_file_parser("normal_requires_main.plain", [get_test_data_path("data/requires")])
|
|
File without changes
|
|
File without changes
|
|
File without changes
|