Skip to content
Snippets Groups Projects
Commit 6069e204 authored by carignani's avatar carignani
Browse files

remove 'generated' prefix, fix test, fix regex to parse example body

parent 00ac479b
No related branches found
No related tags found
No related merge requests found
......@@ -14,7 +14,7 @@ from docx.text.paragraph import Paragraph
from example import generate_examples_between
BASE_FILENAME = "generated_etsi_nfv_sol001_{}_{}_types.yaml"
BASE_FILENAME = "etsi_nfv_sol001_{}_{}_types.yaml"
TOSCA_VERSION = "tosca_simple_yaml_1_2"
DEFAULT_TOSCA_VERSION = "tosca_simple_yaml_1_2"
SPEC_VERSION = "v2.6.1"
......
......@@ -27,17 +27,15 @@ def is_body_of_example(line: str):
'''
Returns true if the line is part of the body of an example.
'''
return line.startswith("imports:") or\
line.startswith("node_types:") or\
line.startswith("topology_template:") or\
line.startswith("description:") or\
line.startswith("data_types:") or\
line.startswith(" ") or\
line.startswith(" ") or\
line == ""
return line == "" or \
line.startswith(".") or \
line.startswith("#") or \
line.startswith(" ") or \
bool(re.match(r'^[a-zA-Z_]*:',line))
def get_example_file_name(line: str):
'''
Looks for the YAML filename in the line of text
'''
matches = re.search(r'[a-zA-Z0-9_.]*.yaml', line)
if matches is not None:
......
......@@ -397,7 +397,7 @@ MyExampleNS_2.yaml:"""
line3 = """Virtual IP address connection points (VipCps) are used to allocate one or multiple IP addresses that are shared by other CP instances, which may be instances of the same or of different VduCp or VnfExtCp nodes."""
assert d2t.get_example_file_name(line1) == "MyExampleNS_2.yaml"
assert d2t.get_example_file_name(line2) == "MyExampleNs_Type.yaml"
assert d2t.get_example_file_name(line3) == ""
assert exp.get_example_file_name(line1) == "MyExampleNS_2.yaml"
assert exp.get_example_file_name(line2) == "MyExampleNs_Type.yaml"
assert exp.get_example_file_name(line3) == ""
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment