Skip to content

Commit 4b741ca

Browse files
authored
Merge pull request #2491 from strictdoc-project/stanislaw/section
chore(tests/integration): migrate several itests from [SECTION] to [[SECTION]]
2 parents f083294 + c1c0489 commit 4b741ca

File tree

52 files changed

+204
-302
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+204
-302
lines changed

strictdoc/backend/sdoc/models/document_grammar.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ def create_default_section_element(
344344
parent=None,
345345
title=RequirementFieldName.MID,
346346
human_title=None,
347-
required="True",
347+
required="False",
348348
)
349349
)
350350
fields.append(

strictdoc/backend/sdoc/processor.py

Lines changed: 12 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -126,29 +126,6 @@ def process_section(self, section: SDocSection) -> None:
126126
)
127127
preserve_source_location_data(section)
128128

129-
# FIXME: Refactor to eliminate the need in such assert.
130-
assert self.parse_context.document_config is not None
131-
132-
if self.parse_context.document_config.auto_levels:
133-
if (
134-
section.ng_resolved_custom_level
135-
and section.ng_resolved_custom_level != "None"
136-
):
137-
raise StrictDocException(
138-
"[SECTION].LEVEL field is provided. "
139-
"This contradicts to the option "
140-
"[DOCUMENT].OPTIONS.AUTO_LEVELS set to On. "
141-
f"Section: {section}"
142-
)
143-
else:
144-
if not section.ng_resolved_custom_level:
145-
raise StrictDocException(
146-
"[SECTION].LEVEL field is not provided. "
147-
"This contradicts to the option "
148-
"[DOCUMENT].OPTIONS.AUTO_LEVELS set to Off. "
149-
f"Section: {section}"
150-
)
151-
152129
def process_document_from_file(
153130
self, document_from_file: DocumentFromFile
154131
) -> None:
@@ -213,6 +190,18 @@ def process_requirement(self, requirement: SDocNode) -> None:
213190

214191
preserve_source_location_data(requirement)
215192

193+
# FIXME: Refactor to eliminate the need in such assert.
194+
assert self.parse_context.document_config is not None
195+
196+
if not self.parse_context.document_config.auto_levels:
197+
if not requirement.ng_resolved_custom_level:
198+
raise StrictDocException(
199+
f"[{requirement.node_type}].LEVEL field is not provided. "
200+
"This contradicts to the option "
201+
"[DOCUMENT].OPTIONS.AUTO_LEVELS set to Off. "
202+
f"Node: {requirement}"
203+
)
204+
216205
def process_node_field(self, node_field: SDocNodeField) -> None:
217206
node_field_parts = node_field.parts
218207
if (

strictdoc/core/query_engine/query_object.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -268,11 +268,7 @@ def _evaluate_node_field_expression(
268268
expression: NodeFieldExpression,
269269
) -> Optional[str]:
270270
field_name = expression.field_name
271-
if (
272-
isinstance(node, SDocNode)
273-
and node.is_requirement()
274-
and node.node_type == "REQUIREMENT"
275-
):
271+
if isinstance(node, SDocNode):
276272
requirement: SDocNode = assert_cast(node, SDocNode)
277273
requirement_document: SDocDocument = assert_cast(
278274
requirement.get_document(), SDocDocument

strictdoc/export/html/templates/components/node_content/tiny.jinja

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
{%- endif %}
1212
data-testid="requirement-style-{{ requirement_style|d(sdoc_entity.get_requirement_style_mode()) }}"
1313
>
14-
{% set title_number = false %}
14+
{% set title_number = true %}
1515
{% set truncated_statement = true %}
1616
{% include "components/node_field/title/index.jinja" %}
1717
{% include "components/node_field/uid/index.jinja" %}

strictdoc/export/html/templates/screens/document/table/main.jinja

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,7 @@
3030
{%- set requirement = node %}
3131
<tr>
3232
<td class="content-view-td content-view-td-type">
33-
{%- if node.is_text_node() %}
34-
Text
35-
{%- else %}
36-
Requirement
37-
{%- endif -%}
33+
{{ node.node_type }}
3834
</td>
3935
<td class="content-view-td content-view-td-meta">
4036
{{ requirement.context.title_number_string }}

tests/integration/features/commands/bypass/50_nested_document_from_file/nested/subnested/input3.sdoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[DOCUMENT]
22
TITLE: Hello world doc 3
33

4-
[SECTION]
4+
[[SECTION]]
55
TITLE: Section 1
66

77
[REQUIREMENT]
@@ -12,4 +12,4 @@ STATEMENT: ...
1212
TITLE: Req-2
1313
STATEMENT: ...
1414

15-
[/SECTION]
15+
[[/SECTION]]

tests/integration/features/commands/manage/auto-uid/01_issue_1630_autouid_must_preserve_relations_DEPRECATED/input.sdoc

Lines changed: 0 additions & 90 deletions
This file was deleted.

tests/integration/features/commands/manage/auto-uid/01_issue_1630_autouid_must_preserve_relations_DEPRECATED/test.itest

Lines changed: 0 additions & 14 deletions
This file was deleted.

tests/integration/features/commands/manage/auto-uid/composable_documents/_validations/01_validate_link_to_non_existing_document/nested.sdoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ OPTIONS:
66
[DOCUMENT_FROM_FILE]
77
FILE: subnested.sdoc
88

9-
[SECTION]
9+
[[SECTION]]
1010
TITLE: Nested Doc Section
1111

1212
[COMPOSITE_REQUIREMENT]
@@ -17,4 +17,4 @@ TITLE: Nested Doc Section Requirement
1717

1818
[/COMPOSITE_REQUIREMENT]
1919

20-
[/SECTION]
20+
[[/SECTION]]

tests/integration/features/commands/manage/auto-uid/requirement_uids/04_requirement_prefix_section_level/input.expected.sdoc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
TITLE: Hello world doc
33
PREFIX: DOC-
44

5-
[SECTION]
6-
TITLE: Section 1
5+
[[SECTION]]
76
PREFIX: LEVEL1-REQ-
7+
TITLE: Section 1
88

99
[REQUIREMENT]
1010
UID: LEVEL1-REQ-1
@@ -14,11 +14,11 @@ STATEMENT: System shall do L1-1.
1414
UID: LEVEL1-REQ-2
1515
STATEMENT: System shall do L1-1.
1616

17-
[/SECTION]
17+
[[/SECTION]]
1818

19-
[SECTION]
20-
TITLE: Section 2
19+
[[SECTION]]
2120
PREFIX: LEVEL2-REQ-
21+
TITLE: Section 2
2222

2323
[REQUIREMENT]
2424
UID: LEVEL2-REQ-2
@@ -28,4 +28,4 @@ STATEMENT: System shall do L2-1.
2828
UID: LEVEL2-REQ-1
2929
STATEMENT: System shall do L2-1.
3030

31-
[/SECTION]
31+
[[/SECTION]]

0 commit comments

Comments
 (0)