Commit 6069e204 authored by carignani's avatar carignani
Browse files

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

parent 00ac479b
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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"
+6 −8
Original line number Diff line number Diff line
@@ -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\
    return line == "" or \
            line.startswith(".") or \
            line.startswith("#") or \
            line.startswith(" ") or \
            line.startswith(" ") or\
            line == ""
            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:
+3 −3
Original line number Diff line number Diff line
@@ -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) == ""