ariatosca-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From emblempar...@apache.org
Subject [1/2] incubator-ariatosca git commit: Consolidate tests using Jinja templates
Date Tue, 19 Sep 2017 21:29:38 GMT
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-1-parser-test-suite a136c92f9 -> 1d8ac549b


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/1d8ac549/tests/extensions/aria_extension_tosca/simple_v1_0/types/common/test_type_interfaces.py
----------------------------------------------------------------------
diff --git a/tests/extensions/aria_extension_tosca/simple_v1_0/types/common/test_type_interfaces.py b/tests/extensions/aria_extension_tosca/simple_v1_0/types/common/test_type_interfaces.py
index 307b40c..65f708c 100644
--- a/tests/extensions/aria_extension_tosca/simple_v1_0/types/common/test_type_interfaces.py
+++ b/tests/extensions/aria_extension_tosca/simple_v1_0/types/common/test_type_interfaces.py
@@ -14,13 +14,6 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-
-"""
-Developer note: make sure that these tests mirror those in:
- test_interface_type.py,
- test_node_type_relationship_interfaces.py.
-"""
-
 import itertools
 
 import pytest
@@ -28,413 +21,323 @@ import pytest
 from ... import data
 
 
-TYPE_NAMES = ('node', 'relationship', 'group')
+MAIN_MACROS = """
+{% macro additions() %}
+{%- endmacro %}
+{% macro interfaces() %}
+    interfaces: {{ caller()|indent(6) }}
+{%- endmacro %}
+"""
+
+RELATIONSHIP_MACROS = """
+{% macro additions() %}
+capability_types:
+  MyType: {}
+relationship_types:
+  MyType: {}
+{%- endmacro %}
+{% macro interfaces() %}
+    requirements:
+      - my_requirement:
+          capability: MyType
+          relationship:
+            type: MyType
+            interfaces: {{ caller()|indent(14) }}
+{%- endmacro %}
+"""
+
+MACROS = {
+    'main': MAIN_MACROS,
+    'relationship': RELATIONSHIP_MACROS
+}
+
+INTERFACE_SECTIONS = (
+    ('main', 'node'),
+    ('main', 'group'),
+    ('main', 'relationship'),
+    ('relationship', 'node')
+)
 
 
 # Syntax
 
-@pytest.mark.parametrize('name,value', itertools.product(
-    TYPE_NAMES,
-    data.NOT_A_DICT
-))
-def test_type_interface_wrong_yaml_type(parser, name, value):
-    parser.parse_literal("""
+@pytest.mark.parametrize(
+    'macros,name,value',
+    ((s[0], s[1], v)
+     for s, v in itertools.product(INTERFACE_SECTIONS, data.NOT_A_DICT))
+)
+def test_type_interface_wrong_yaml_type(parser, macros, name, value):
+    parser.parse_literal(MACROS[macros] + """
 tosca_definitions_version: tosca_simple_yaml_1_0
+{{- additions() }}
 interface_types:
   MyType: {}
 {{ name }}_types:
   MyType:
-    interfaces:
-      my_interface: {{ value }}
+{%- call interfaces() %}
+my_interface: {{ value }}
+{% endcall %}
 """, dict(name=name, value=value)).assert_failure()
 
 
-@pytest.mark.parametrize('name', TYPE_NAMES)
-def test_type_interface_empty(parser, name):
-    parser.parse_literal("""
+@pytest.mark.parametrize('macros,name', INTERFACE_SECTIONS)
+def test_type_interface_empty(parser, macros, name):
+    parser.parse_literal(MACROS[macros] + """
 tosca_definitions_version: tosca_simple_yaml_1_0
+{{- additions() }}
 {{ name }}_types:
   MyType:
-    interfaces:
-      my_interface: {} # "type" is required
+{%- call interfaces() %}
+my_interface: {} # "type" is required
+{% endcall %}
 """, dict(name=name)).assert_failure()
 
 
-@pytest.mark.parametrize('name', TYPE_NAMES)
-def test_type_interface_fields(parser, name):
-    parser.parse_literal("""
-tosca_definitions_version: tosca_simple_yaml_1_0
-interface_types:
-  MyType: {}
-{{ name }}_types:
-  MyType:
-    interfaces:
-      my_interface:
-        type: MyType
-        inputs: {}
-        my_operation1: {}
-        my_operation2: {}
-""", dict(name=name)).assert_success()
-
-
 # Type
 
-@pytest.mark.parametrize('name', TYPE_NAMES)
-def test_type_interface_type_override(parser, name):
-    parser.parse_literal("""
+@pytest.mark.parametrize('macros,name', INTERFACE_SECTIONS)
+def test_type_interface_type_override(parser, macros, name):
+    parser.parse_literal(MACROS[macros] + """
 tosca_definitions_version: tosca_simple_yaml_1_0
+{{- additions() }}
 interface_types:
   MyType1: {}
   MyType2:
     derived_from: MyType1
 {{ name }}_types:
   MyType1:
-    interfaces:
-      my_interface:
-        type: MyType1
+{%- call interfaces() %}
+my_interface:
+  type: MyType1
+{% endcall %}
   MyType2:
     derived_from: MyType1
-    interfaces:
-      my_interface:
-        type: MyType2
+{%- call interfaces() %}
+my_interface:
+  type: MyType2
+{% endcall %}
 """, dict(name=name)).assert_success()
 
 
-@pytest.mark.parametrize('name', TYPE_NAMES)
-def test_type_interface_type_override_bad(parser, name):
-    parser.parse_literal("""
+@pytest.mark.skip(reason='fix for node.relationship')
+@pytest.mark.parametrize('macros,name', INTERFACE_SECTIONS)
+def test_type_interface_type_override_bad(parser, macros, name):
+    parser.parse_literal(MACROS[macros] + """
 tosca_definitions_version: tosca_simple_yaml_1_0
+{{- additions() }}
 interface_types:
   MyType1: {}
   MyType2:
     derived_from: MyType1
 {{ name }}_types:
   MyType1:
-    interfaces:
-      my_interface:
-        type: MyType2
+{%- call interfaces() %}
+my_interface:
+  type: MyType2
+{% endcall %}
   MyType2:
     derived_from: MyType1
-    interfaces:
-      my_interface:
-        type: MyType1
+{%- call interfaces() %}
+my_interface:
+  type: MyType1
+{% endcall %}
 """, dict(name=name)).assert_failure()
 
 
-# Interface inputs
-
-@pytest.mark.parametrize('name', TYPE_NAMES)
-def test_type_interface_inputs_add(parser, name):
-    parser.parse_literal("""
-tosca_definitions_version: tosca_simple_yaml_1_0
-interface_types:
-  MyType:
-    inputs:
-      my_input1:
-        type: string
-{{ name }}_types:
-  MyType:
-    interfaces:
-      my_interface:
-        type: MyType
-        inputs:
-          my_input2:
-            type: string
-""", dict(name=name)).assert_success()
-
+# Operations
 
-@pytest.mark.parametrize('name', TYPE_NAMES)
-def test_type_interface_inputs_type_override_same(parser, name):
-    parser.parse_literal("""
+@pytest.mark.parametrize('macros,name', INTERFACE_SECTIONS)
+def test_type_interface_operation_empty(parser, macros, name):
+    parser.parse_literal(MACROS[macros] + """
 tosca_definitions_version: tosca_simple_yaml_1_0
+{{- additions() }}
 interface_types:
-  MyType:
-    inputs:
-      my_input:
-        type: string
+  MyType: {}
 {{ name }}_types:
   MyType:
-    interfaces:
-      my_interface:
-        type: MyType
-        inputs:
-          my_input:
-            type: string
+{%- call interfaces() %}
+my_interface:
+  type: MyType
+  my_operation: {}
+{% endcall %}
 """, dict(name=name)).assert_success()
 
 
-@pytest.mark.parametrize('name', TYPE_NAMES)
-def test_type_interface_inputs_type_override_derived(parser, name):
-    parser.parse_literal("""
-tosca_definitions_version: tosca_simple_yaml_1_0
-data_types:
-  MyType1: {}
-  MyType2:
-    derived_from: MyType1
-interface_types:
-  MyType:
-    inputs:
-      my_input:
-        type: MyType1
-{{ name }}_types:
-  MyType:
-    interfaces:
-      my_interface:
-        type: MyType
-        inputs:
-          my_input:
-            type: MyType2
-""", dict(name=name)).assert_success()
-
+# Operation description
 
-@pytest.mark.skip(reason='fix')
-@pytest.mark.parametrize('name', TYPE_NAMES)
-def test_type_interface_inputs_type_override_bad(parser, name):
-    parser.parse_literal("""
-tosca_definitions_version: tosca_simple_yaml_1_0
-data_types:
-  MyType1: {}
-  MyType2:
-    derived_from: MyType1
-interface_types:
-  MyType:
-    inputs:
-      my_input:
-        type: MyType2
-{{ name }}_types:
-  MyType:
-    interfaces:
-      my_interface:
-        type: MyType
-        inputs:
-          my_input:
-            type: MyType1
-""", dict(name=name)).assert_failure()
-
-
-# Operations
-
-@pytest.mark.parametrize('name', TYPE_NAMES)
-def test_type_interface_operation_empty(parser, name):
-    parser.parse_literal("""
+@pytest.mark.parametrize(
+    'macros,name,value',
+    ((s[0], s[1], v)
+     for s, v in itertools.product(INTERFACE_SECTIONS, data.NOT_A_DICT))
+)
+def test_type_interface_operation_description_wrong_yaml_type(parser, macros, name, value):
+    parser.parse_literal(MACROS[macros] + """
 tosca_definitions_version: tosca_simple_yaml_1_0
+{{- additions() }}
 interface_types:
   MyType: {}
 {{ name }}_types:
   MyType:
-    interfaces:
-      my_interface:
-        type: MyType
-        my_operation: {}
-""", dict(name=name)).assert_success()
-
+{%- call interfaces() %}
+my_interface:
+  type: MyType
+  my_operation:
+    description: {{ value }}
+{% endcall %}
+""", dict(name=name)).assert_failure()
 
-@pytest.mark.parametrize('name', TYPE_NAMES)
-def test_type_interface_operation_fields(parser, name):
-    parser.parse_literal("""
+@pytest.mark.parametrize('macros,name', INTERFACE_SECTIONS)
+def test_type_interface_operation_description(parser, macros, name):
+    parser.parse_literal(MACROS[macros] + """
 tosca_definitions_version: tosca_simple_yaml_1_0
+{{- additions() }}
 interface_types:
   MyType: {}
 {{ name }}_types:
   MyType:
-    interfaces:
-      my_interface:
-        type: MyType
-        my_operation:
-          description: a description
-          implementation: {}
-          inputs: {}
+{%- call interfaces() %}
+my_interface:
+  type: MyType
+  my_operation:
+    description: a description
+{% endcall %}
 """, dict(name=name)).assert_success()
 
 
 # Operation implementation
 
-@pytest.mark.parametrize('name', TYPE_NAMES)
-def test_type_interface_operation_implementation_short_form(parser, name):
-    parser.parse_literal("""
+@pytest.mark.parametrize('macros,name', INTERFACE_SECTIONS)
+def test_type_interface_operation_implementation_short_form(parser, macros, name):
+    parser.parse_literal(MACROS[macros] + """
 tosca_definitions_version: tosca_simple_yaml_1_0
+{{- additions() }}
 interface_types:
   MyType: {}
 {{ name }}_types:
   MyType:
-    interfaces:
-      my_interface:
-        type: MyType
-        my_operation:
-          implementation: an implementation
+{%- call interfaces() %}
+my_interface:
+  type: MyType
+  my_operation:
+    implementation: an implementation
+{% endcall %}
 """, dict(name=name)).assert_success()
 
 
-@pytest.mark.parametrize('name', TYPE_NAMES)
-def test_type_interface_operation_implementation_long_form(parser, name):
-    parser.parse_literal("""
+@pytest.mark.parametrize('macros,name', INTERFACE_SECTIONS)
+def test_type_interface_operation_implementation_long_form(parser, macros, name):
+    parser.parse_literal(MACROS[macros] + """
 tosca_definitions_version: tosca_simple_yaml_1_0
+{{- additions() }}
 interface_types:
   MyType: {}
 {{ name }}_types:
   MyType:
-    interfaces:
-      my_interface:
-        type: MyType
-        my_operation:
-          implementation:
-            primary: an implementation
-            dependencies:
-              - a dependency
-              - another dependency
+{%- call interfaces() %}
+my_interface:
+  type: MyType
+  my_operation:
+    implementation:
+      primary: an implementation
+      dependencies:
+        - a dependency
+        - another dependency
+{% endcall %}
 """, dict(name=name)).assert_success()
 
 
-@pytest.mark.parametrize('name,value', itertools.product(
-    TYPE_NAMES,
-    data.NOT_A_STRING
-))
-def test_type_interface_operation_implementation_wrong_yaml_type(parser, name, value):
-    parser.parse_literal("""
+@pytest.mark.parametrize(
+    'macros,name,value',
+    ((s[0], s[1], v)
+     for s, v in itertools.product(INTERFACE_SECTIONS, data.NOT_A_STRING))
+)
+def test_type_interface_operation_implementation_primary_wrong_yaml_type(parser, macros, name,
+                                                                         value):
+    parser.parse_literal(MACROS[macros] + """
 tosca_definitions_version: tosca_simple_yaml_1_0
+{{- additions() }}
 interface_types:
   MyType: {}
 {{ name }}_types:
   MyType:
-    interfaces:
-      my_interface:
-        type: MyType
-        my_operation:
-          implementation:
-            primary: {{ value }}
+{%- call interfaces() %}
+my_interface:
+  type: MyType
+  my_operation:
+    implementation:
+      primary: {{ value }}
+{% endcall %}
 """, dict(name=name, value=value)).assert_failure()
 
 
-@pytest.mark.parametrize('name,value', itertools.product(
-    TYPE_NAMES,
-    data.NOT_A_STRING
-))
-def test_type_interface_operation_dependencies_wrong_yaml_type(parser, name, value):
-    parser.parse_literal("""
+@pytest.mark.parametrize(
+    'macros,name,value',
+    ((s[0], s[1], v)
+     for s, v in itertools.product(INTERFACE_SECTIONS, data.NOT_A_LIST))
+)
+def test_type_interface_operation_implementation_dependencies_wrong_yaml_type(parser, macros, name,
+                                                                              value):
+    parser.parse_literal(MACROS[macros] + """
 tosca_definitions_version: tosca_simple_yaml_1_0
+{{- additions() }}
 interface_types:
   MyType: {}
 {{ name }}_types:
   MyType:
-    interfaces:
-      my_interface:
-        type: MyType
-        my_operation:
-          implementation:
-            primary: an implementation
-            dependencies:
-              - {{ value }}
+{%- call interfaces() %}
+my_interface:
+  type: MyType
+  my_operation:
+    implementation:
+      primary: an implementation
+      dependencies: {{ value }}
+{% endcall %}
 """, dict(name=name, value=value)).assert_failure()
 
 
-# Operation inputs
-
-@pytest.mark.parametrize('name', TYPE_NAMES)
-def test_type_interface_operation_inputs_add(parser, name):
-    parser.parse_literal("""
+@pytest.mark.parametrize(
+    'macros,name,value',
+    ((s[0], s[1], v)
+     for s, v in itertools.product(INTERFACE_SECTIONS, data.NOT_A_STRING))
+)
+def test_type_interface_operation_implementation_dependencies_element_wrong_yaml_type(parser,
+                                                                                      macros,
+                                                                                      name,
+                                                                                      value):
+    parser.parse_literal(MACROS[macros] + """
 tosca_definitions_version: tosca_simple_yaml_1_0
+{{- additions() }}
 interface_types:
-  MyType:
-    inputs:
-      my_input:
-        type: string
-{{ name }}_types:
-  MyType:
-    interfaces:
-      my_interface:
-        type: MyType
-        my_operation:
-          inputs:
-            my_input:
-              type: string
-""", dict(name=name)).assert_success()
-
-
-@pytest.mark.parametrize('name', TYPE_NAMES)
-def test_type_interface_operation_inputs_override_same_type(parser, name):
-    parser.parse_literal("""
-tosca_definitions_version: tosca_simple_yaml_1_0
-interface_types:
-  MyType:
-    inputs:
-      my_input:
-        type: string
-{{ name }}_types:
-  MyType:
-    interfaces:
-      my_interface:
-        type: MyType
-        my_operation:
-          inputs:
-            my_input:
-              type: string
-""", dict(name=name)).assert_success()
-
-
-@pytest.mark.parametrize('name', TYPE_NAMES)
-def test_type_interface_operation_inputs_override_derived_type(parser, name):
-    parser.parse_literal("""
-tosca_definitions_version: tosca_simple_yaml_1_0
-data_types:
-  MyType1: {}
-  MyType2:
-    derived_from: MyType1
-interface_types:
-  MyType:
-    inputs:
-      my_input:
-        type: MyType1
-{{ name }}_types:
-  MyType:
-    interfaces:
-      my_interface:
-        type: MyType
-        my_operation:
-          inputs:
-            my_input:
-              type: MyType2
-""", dict(name=name)).assert_success()
-
-
-@pytest.mark.skip(reason='fix')
-@pytest.mark.parametrize('name', TYPE_NAMES)
-def test_type_interface_operation_inputs_override_bad(parser, name):
-    parser.parse_literal("""
-tosca_definitions_version: tosca_simple_yaml_1_0
-data_types:
-  MyType1: {}
-  MyType2:
-    derived_from: MyType1
-interface_types:
-  MyType:
-    inputs:
-      my_input:
-        type: MyType2
+  MyType: {}
 {{ name }}_types:
   MyType:
-    interfaces:
-      my_interface:
-        type: MyType
-        my_operation:
-          inputs:
-            my_input:
-              type: MyType1
-""", dict(name=name)).assert_failure()
+{%- call interfaces() %}
+my_interface:
+  type: MyType
+  my_operation:
+    implementation:
+      primary: an implementation
+      dependencies:
+        - {{ value }}
+{% endcall %}
+""", dict(name=name, value=value)).assert_failure()
 
 
 # Unicode
 
-@pytest.mark.parametrize('name', TYPE_NAMES)
-def test_type_interface_unicode(parser, name):
-    parser.parse_literal("""
+@pytest.mark.parametrize('macros,name', INTERFACE_SECTIONS)
+def test_type_interface_unicode(parser, macros, name):
+    parser.parse_literal(MACROS[macros] + """
 tosca_definitions_version: tosca_simple_yaml_1_0
+{{- additions() }}
 interface_types:
   類型: {}
 {{ name }}_types:
   類型:
-    interfaces:
-      接口:
-        type: 類型
-        手術:
-          implementation: 履行
+{%- call interfaces() %}
+接口:
+  type: 類型
+  手術:
+    implementation: 履行
+{% endcall %}
 """, dict(name=name)).assert_success()

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/1d8ac549/tests/extensions/aria_extension_tosca/simple_v1_0/types/common/test_type_parameters.py
----------------------------------------------------------------------
diff --git a/tests/extensions/aria_extension_tosca/simple_v1_0/types/common/test_type_parameters.py b/tests/extensions/aria_extension_tosca/simple_v1_0/types/common/test_type_parameters.py
index aa2eda6..2fd67b0 100644
--- a/tests/extensions/aria_extension_tosca/simple_v1_0/types/common/test_type_parameters.py
+++ b/tests/extensions/aria_extension_tosca/simple_v1_0/types/common/test_type_parameters.py
@@ -21,161 +21,430 @@ import pytest
 from ... import data
 
 
+MAIN_MACROS = """
+{% macro additions() %}
+{%- endmacro %}
+{% macro parameters() %}
+    {{ parameter_section }}: {{ caller()|indent(6) }}
+{%- endmacro %}
+"""
+
+NESTED_MACROS = """
+{% macro additions() %}
+{%- endmacro %}
+{% macro parameters() %}
+    nested:
+      {{ parameter_section }}: {{ caller()|indent(8) }}
+{%- endmacro %}
+"""
+
+INTERFACE_MACROS = """
+{% macro additions() %}
+interface_types:
+  MyType: {}
+{%- endmacro %}
+{% macro parameters() %}
+    interfaces:
+      my_interface:
+        type: MyType
+        {{ parameter_section }}: {{ caller()|indent(10) }}
+{%- endmacro %}
+"""
+
+OPERATION_MACROS = """
+{% macro additions() %}
+interface_types:
+  MyType: {}
+{%- endmacro %}
+{% macro parameters() %}
+    interfaces:
+      my_interface:
+        type: MyType
+        my_operation:
+          {{ parameter_section }}: {{ caller()|indent(12) }}
+{%- endmacro %}
+"""
+
+RELATIONSHIP_INTERFACE_MACROS = """
+{% macro additions() %}
+capability_types:
+  MyType: {}
+relationship_types:
+  MyType: {}
+interface_types:
+  MyType: {}
+{%- endmacro %}
+{% macro parameters() %}
+    requirements:
+      - my_requirement:
+          capability: MyType
+          relationship:
+            type: MyType
+            interfaces:
+              my_interface:
+                type: MyType
+                {{ parameter_section }}: {{ caller()|indent(20) }}
+{%- endmacro %}
+"""
+
+RELATIONSHIP_OPERATION_MACROS = """
+{% macro additions() %}
+capability_types:
+  MyType: {}
+relationship_types:
+  MyType: {}
+interface_types:
+  MyType: {}
+{%- endmacro %}
+{% macro parameters() %}
+    requirements:
+      - my_requirement:
+          capability: MyType
+          relationship:
+            type: MyType
+            interfaces:
+              my_interface:
+                type: MyType
+                my_operation:
+                  {{ parameter_section }}: {{ caller()|indent(22) }}
+{%- endmacro %}
+"""
+
+CAPABILITY_MACROS = """
+{% macro additions() %}
+capability_types:
+  MyType: {}
+{%- endmacro %}
+{% macro parameters() %}
+    capabilities:
+      my_capability:
+        type: MyType
+        {{ parameter_section }}: {{ caller()|indent(10) }}
+{%- endmacro %}
+"""
+
+MACROS = {
+    'main': MAIN_MACROS,
+    'nested': NESTED_MACROS,
+    'interface': INTERFACE_MACROS,
+    'operation': OPERATION_MACROS,
+    'relationship-interface': RELATIONSHIP_INTERFACE_MACROS,
+    'relationship-operation': RELATIONSHIP_OPERATION_MACROS,
+    'capability': CAPABILITY_MACROS
+}
+
+PARAMETER_SECTIONS = (
+    ('main', 'node', 'properties'),
+    ('main', 'node', 'attributes'),
+    ('main', 'group', 'properties'),
+    ('main', 'relationship', 'properties'),
+    ('main', 'relationship', 'attributes'),
+    ('main', 'capability', 'properties'),
+    ('main', 'capability', 'attributes'),
+    ('main', 'policy', 'properties'),
+    ('main', 'interface', 'inputs'),
+    ('main', 'artifact', 'properties'),
+    ('main', 'data', 'properties'),
+    ('nested', 'interface', 'inputs'),
+    ('interface', 'node', 'inputs'),
+    ('interface', 'group', 'inputs'),
+    ('interface', 'relationship', 'inputs'),
+    ('operation', 'node', 'inputs'),
+    ('operation', 'group', 'inputs'),
+    ('operation', 'relationship', 'inputs'),
+    ('relationship-interface', 'node', 'inputs'),
+    ('relationship-operation', 'node', 'inputs'),
+    ('capability', 'node', 'properties'),
+    ('capability', 'node', 'attributes')
+)
+
+PROPERTY_SECTIONS = (
+    ('main', 'node', 'properties'),
+    ('main', 'group', 'properties'),
+    ('main', 'relationship', 'properties'),
+    ('main', 'capability', 'properties'),
+    ('main', 'policy', 'properties'),
+    ('main', 'interface', 'inputs'),
+    ('main', 'artifact', 'properties'),
+    ('main', 'data', 'properties'),
+    ('nested', 'interface', 'inputs'),
+    ('interface', 'node', 'inputs'),
+    ('interface', 'group', 'inputs'),
+    ('interface', 'relationship', 'inputs'),
+    ('operation', 'node', 'inputs'),
+    ('operation', 'group', 'inputs'),
+    ('operation', 'relationship', 'inputs'),
+    ('relationship-interface', 'node', 'inputs'),
+    ('relationship-operation', 'node', 'inputs'),
+    ('capability', 'node', 'properties')
+)
+
+
 # Syntax
 
 @pytest.mark.parametrize(
-    'name,parameter_section,value',
-    ((s[0], s[1], v)
-     for s, v in itertools.product(data.PARAMETER_SECTIONS, data.NOT_A_DICT))
+    'macros,name,parameter_section,value',
+    ((s[0], s[1], s[2], v)
+     for s, v in itertools.product(PARAMETER_SECTIONS, data.NOT_A_DICT))
 )
-def test_type_parameter_section_wrong_yaml_type(parser, name, parameter_section, value):
-    parser.parse_literal("""
+def test_type_parameter_section_wrong_yaml_type(parser, macros, name, parameter_section, value):
+    parser.parse_literal(MACROS[macros] + """
 tosca_definitions_version: tosca_simple_yaml_1_0
+{{- additions() }}
 {{ name }}_types:
   MyType:
-    {{ parameter_section }}: {{ value }}
+{%- call parameters() -%}
+{{ value }}
+{% endcall %}
 """, dict(name=name, parameter_section=parameter_section, value=value)).assert_failure()
 
 
-@pytest.mark.parametrize('name,parameter_section', data.PARAMETER_SECTIONS)
-def test_type_parameter_section_empty(parser, name, parameter_section):
-    parser.parse_literal("""
+@pytest.mark.parametrize('macros,name,parameter_section', PARAMETER_SECTIONS)
+def test_type_parameter_section_empty(parser, macros, name, parameter_section):
+    parser.parse_literal(MACROS[macros] + """
 tosca_definitions_version: tosca_simple_yaml_1_0
+{{- additions() }}
 {{ name }}_types:
   MyType:
-    {{ parameter_section }}: {}
+{%- call parameters() -%}
+{}
+{% endcall %}
 """, dict(name=name, parameter_section=parameter_section)).assert_success()
 
 
 @pytest.mark.parametrize(
-    'name,parameter_section,value',
-    ((s[0], s[1], v)
-     for s, v in itertools.product(data.PARAMETER_SECTIONS, data.NOT_A_DICT))
+    'macros,name,parameter_section,value',
+    ((s[0], s[1], s[2], v)
+     for s, v in itertools.product(PARAMETER_SECTIONS, data.NOT_A_DICT))
 )
-def test_type_parameter_wrong_yaml_type(parser, name, parameter_section, value):
-    parser.parse_literal("""
+def test_type_parameter_wrong_yaml_type(parser, macros, name, parameter_section, value):
+    parser.parse_literal(MACROS[macros] + """
 tosca_definitions_version: tosca_simple_yaml_1_0
+{{- additions() }}
 {{ name }}_types:
   MyType:
-    {{ parameter_section }}:
-      my_parameter: {{ value }}
+{%- call parameters() %}
+my_parameter: {{ value }}
+{% endcall %}
 """, dict(name=name, parameter_section=parameter_section, value=value)).assert_failure()
 
 
-@pytest.mark.parametrize('name,parameter_section', data.PARAMETER_SECTIONS)
-def test_type_parameter_empty(parser, name, parameter_section):
-    parser.parse_literal("""
+@pytest.mark.parametrize('macros,name,parameter_section', PARAMETER_SECTIONS)
+def test_type_parameter_empty(parser, macros, name, parameter_section):
+    parser.parse_literal(MACROS[macros] + """
 tosca_definitions_version: tosca_simple_yaml_1_0
+{{- additions() }}
 {{ name }}_types:
   MyType:
-    {{ parameter_section }}:
-      my_parameter: {} # type is required
+{%- call parameters() %}
+my_parameter: {} # type is required
+{% endcall %}
 """, dict(name=name, parameter_section=parameter_section)).assert_failure()
 
 
-@pytest.mark.parametrize('name,parameter_section', data.PARAMETER_SECTIONS)
-def test_type_parameter_unsupported_field(parser, name, parameter_section):
-    parser.parse_literal("""
+@pytest.mark.parametrize('macros,name,parameter_section', PARAMETER_SECTIONS)
+def test_type_parameter_unsupported_field(parser, macros, name, parameter_section):
+    parser.parse_literal(MACROS[macros] + """
 tosca_definitions_version: tosca_simple_yaml_1_0
+{{- additions() }}
 {{ name }}_types:
   MyType:
-    {{ parameter_section }}:
-      my_parameter:
-        unsupported_field: {}
+{%- call parameters() %}
+my_parameter:
+  type: string
+  unsupported: {}
+{% endcall %}
 """, dict(name=name, parameter_section=parameter_section)).assert_failure()
 
 
-# Fields
+# Description
+
+@pytest.mark.parametrize(
+    'macros,name,parameter_section,value',
+    ((s[0], s[1], s[2], v)
+     for s, v in itertools.product(PARAMETER_SECTIONS, data.NOT_A_STRING))
+)
+def test_type_parameter_description_wrong_yaml_type(parser, macros, name, parameter_section, value):
+    parser.parse_literal(MACROS[macros] + """
+tosca_definitions_version: tosca_simple_yaml_1_0
+{{- additions() }}
+{{ name }}_types:
+  MyType:
+{%- call parameters() %}
+my_parameter:
+  type: string
+  description: {{ value }}
+{% endcall %}
+""", dict(name=name, parameter_section=parameter_section, value=value)).assert_failure()
+
 
-@pytest.mark.parametrize('name,parameter_section', data.PARAMETER_SECTIONS)
-def test_type_parameter_fields(parser, name, parameter_section):
-    parser.parse_literal("""
+@pytest.mark.parametrize('macros,name,parameter_section', PARAMETER_SECTIONS)
+def test_type_parameter_description(parser, macros, name, parameter_section):
+    parser.parse_literal(MACROS[macros] + """
 tosca_definitions_version: tosca_simple_yaml_1_0
+{{- additions() }}
 {{ name }}_types:
   MyType:
-    {{ parameter_section }}:
-      my_parameter:
-        type: string
-        description: a description
-        default: a value
-        status: supported
+{%- call parameters() %}
+my_parameter:
+  type: string
+  description: a description
+{% endcall %}
+""", dict(name=name, parameter_section=parameter_section)).assert_success()
+
+
+# Default
+
+@pytest.mark.parametrize('macros,name,parameter_section', PARAMETER_SECTIONS)
+def test_type_parameter_default(parser, macros, name, parameter_section):
+    parser.parse_literal(MACROS[macros] + """
+tosca_definitions_version: tosca_simple_yaml_1_0
+{{- additions() }}
+{{ name }}_types:
+  MyType:
+{%- call parameters() %}
+my_parameter:
+  type: string
+  default: a string
+{% endcall %}
+""", dict(name=name, parameter_section=parameter_section)).assert_success()
+
+
+@pytest.mark.parametrize('macros,name,parameter_section', PARAMETER_SECTIONS)
+def test_type_parameter_default_bad(parser, macros, name, parameter_section):
+    parser.parse_literal(MACROS[macros] + """
+tosca_definitions_version: tosca_simple_yaml_1_0
+{{- additions() }}
+{{ name }}_types:
+  MyType:
+{%- call parameters() %}
+my_parameter:
+  type: integer
+  default: a string
+{% endcall %}
+""", dict(name=name, parameter_section=parameter_section)).assert_failure()
+
+
+# Required
+
+@pytest.mark.parametrize(
+    'macros,name,parameter_section,value',
+    ((s[0], s[1], s[2], v)
+     for s, v in itertools.product(PROPERTY_SECTIONS, data.NOT_A_BOOL))
+)
+def test_type_parameter_required_wrong_yaml_type(parser, macros, name, parameter_section, value):
+    parser.parse_literal(MACROS[macros] + """
+tosca_definitions_version: tosca_simple_yaml_1_0
+{{- additions() }}
+{{ name }}_types:
+  MyType:
+{%- call parameters() %}
+my_parameter:
+  type: string
+  required: {{ value }}
+{% endcall %}
+""", dict(name=name, parameter_section=parameter_section, value=value)).assert_failure()
+
+@pytest.mark.parametrize('macros,name,parameter_section', PROPERTY_SECTIONS)
+def test_type_parameter_required(parser, macros, name, parameter_section):
+    parser.parse_literal(MACROS[macros] + """
+tosca_definitions_version: tosca_simple_yaml_1_0
+{{- additions() }}
+{{ name }}_types:
+  MyType:
+{%- call parameters() %}
+my_parameter:
+  type: string
+  required: true
+{% endcall %}
 """, dict(name=name, parameter_section=parameter_section)).assert_success()
 
 
 # Status
 
 @pytest.mark.parametrize(
-    'name,parameter_section,value',
-    ((s[0], s[1], v)
-     for s, v in itertools.product(data.PARAMETER_SECTIONS, data.STATUSES))
+    'macros,name,parameter_section,value',
+    ((s[0], s[1], s[2], v)
+     for s, v in itertools.product(PARAMETER_SECTIONS, data.STATUSES))
 )
-def test_type_parameter_status(parser, name, parameter_section, value):
-    parser.parse_literal("""
+def test_type_parameter_status(parser, macros, name, parameter_section, value):
+    parser.parse_literal(MACROS[macros] + """
 tosca_definitions_version: tosca_simple_yaml_1_0
+{{- additions() }}
 {{ name }}_types:
   MyType:
-    {{ parameter_section }}:
-      my_parameter:
-        type: string
-        status: {{ value }}
+{%- call parameters() %}
+my_parameter:
+  type: string
+  status: {{ value }}
+{% endcall %}
 """, dict(name=name, parameter_section=parameter_section, value=value)).assert_success()
 
 
-@pytest.mark.parametrize('name,parameter_section', data.PARAMETER_SECTIONS)
-def test_type_parameter_status_bad(parser, name, parameter_section):
-    parser.parse_literal("""
+@pytest.mark.parametrize('macros,name,parameter_section', PARAMETER_SECTIONS)
+def test_type_parameter_status_bad(parser, macros, name, parameter_section):
+    parser.parse_literal(MACROS[macros] + """
 tosca_definitions_version: tosca_simple_yaml_1_0
+{{- additions() }}
 {{ name }}_types:
   MyType:
-    {{ parameter_section }}:
-      my_parameter:
-        type: string
-        status: not a status
+{%- call parameters() %}
+my_parameter:
+  type: string
+  status: not a status
+{% endcall %}
 """, dict(name=name, parameter_section=parameter_section)).assert_failure()
 
 
 # Constraints
 
 @pytest.mark.parametrize(
-    'name,parameter_section,value',
-    ((s[0], s[1], v)
-     for s, v in itertools.product(data.PARAMETER_WITH_CONSTRAINTS_SECTIONS, data.NOT_A_LIST))
+    'macros,name,parameter_section,value',
+    ((s[0], s[1], s[2], v)
+     for s, v in itertools.product(PROPERTY_SECTIONS, data.NOT_A_LIST))
 )
-def test_type_parameter_constraints_wrong_yaml_type(parser, name, parameter_section, value):
-    parser.parse_literal("""
+def test_type_parameter_constraints_wrong_yaml_type(parser, macros, name, parameter_section,
+                                                    value):
+    parser.parse_literal(MACROS[macros] + """
 tosca_definitions_version: tosca_simple_yaml_1_0
+{{- additions() }}
 {{ name }}_types:
   MyType:
-    {{ parameter_section }}:
-      my_parameter:
-        type: string
-        constraints: {{ value }}
+{%- call parameters() %}
+my_parameter:
+  type: string
+  constraints: {{ value }}
+{% endcall %}
 """, dict(name=name, parameter_section=parameter_section, value=value)).assert_failure()
 
 
-@pytest.mark.parametrize('name,parameter_section', data.PARAMETER_WITH_CONSTRAINTS_SECTIONS)
-def test_type_parameter_constraints_empty(parser, name, parameter_section):
-    parser.parse_literal("""
+@pytest.mark.parametrize('macros,name,parameter_section', PROPERTY_SECTIONS)
+def test_type_parameter_constraints_empty(parser, macros, name, parameter_section):
+    parser.parse_literal(MACROS[macros] + """
 tosca_definitions_version: tosca_simple_yaml_1_0
+{{- additions() }}
 {{ name }}_types:
   MyType:
-    {{ parameter_section }}:
-      my_parameter:
-        type: string
-        constraints: []
+{%- call parameters() %}
+my_parameter:
+  type: string
+  constraints: []
+{% endcall %}
 """, dict(name=name, parameter_section=parameter_section)).assert_success()
 
 
 @pytest.mark.parametrize(
-    'name,parameter_section,constraint',
-    ((s[0], s[1], v)
+    'macros,name,parameter_section,constraint',
+    ((s[0], s[1], s[2], v)
      for s, v in itertools.product(
-         data.PARAMETER_WITH_CONSTRAINTS_SECTIONS,
+         PROPERTY_SECTIONS,
          data.CONSTRAINTS_WITH_VALUE))
 )
-def test_type_parameter_constraints_with_value(parser, name, parameter_section, constraint):
-    parser.parse_literal("""
+def test_type_parameter_constraints_with_value(parser, macros, name, parameter_section,
+                                               constraint):
+    parser.parse_literal(MACROS[macros] + """
 tosca_definitions_version: tosca_simple_yaml_1_0
+{{- additions() }}
 data_types:
   MyDataType:
     properties:
@@ -185,24 +454,27 @@ data_types:
 {{ name }}_types:
 {%- endif %}
   MyType:
-    {{ parameter_section }}:
-      my_parameter:
-        type: MyDataType
-        constraints:
-          - {{ constraint }}: {my_field: a string}
+{%- call parameters() %}
+my_parameter:
+  type: MyDataType
+  constraints:
+    - {{ constraint }}: {my_field: a string}
+{% endcall %}
 """, dict(name=name, parameter_section=parameter_section, constraint=constraint)).assert_success()
 
 
 @pytest.mark.parametrize(
-    'name,parameter_section,constraint',
-    ((s[0], s[1], v)
+    'macros,name,parameter_section,constraint',
+    ((s[0], s[1], s[2], v)
      for s, v in itertools.product(
-         data.PARAMETER_WITH_CONSTRAINTS_SECTIONS,
+         PROPERTY_SECTIONS,
          data.CONSTRAINTS_WITH_VALUE_LIST))
 )
-def test_type_parameter_constraints_with_value_list(parser, name, parameter_section, constraint):
-    parser.parse_literal("""
+def test_type_parameter_constraints_with_value_list(parser, macros, name, parameter_section,
+                                                    constraint):
+    parser.parse_literal(MACROS[macros] + """
 tosca_definitions_version: tosca_simple_yaml_1_0
+{{- additions() }}
 data_types:
   MyDataType:
     properties:
@@ -212,27 +484,30 @@ data_types:
 {{ name }}_types:
 {%- endif %}
   MyType:
-    {{ parameter_section }}:
-      my_parameter:
-        type: MyDataType
-        constraints:
-          - {{ constraint }}:
-            - {my_field: string one}
-            - {my_field: string two}
-            - {my_field: string three}
+{%- call parameters() %}
+my_parameter:
+  type: MyDataType
+  constraints:
+    - {{ constraint }}:
+      - {my_field: string one}
+      - {my_field: string two}
+      - {my_field: string three}
+{% endcall %}
 """, dict(name=name, parameter_section=parameter_section, constraint=constraint)).assert_success()
 
 
 @pytest.mark.parametrize(
-    'name,parameter_section,constraint',
-    ((s[0], s[1], v)
+    'macros,name,parameter_section,constraint',
+    ((s[0], s[1], s[2], v)
      for s, v in itertools.product(
-         data.PARAMETER_WITH_CONSTRAINTS_SECTIONS,
+         PROPERTY_SECTIONS,
          data.CONSTRAINTS_WITH_VALUE_RANGE))
 )
-def test_type_parameter_constraints_with_value_range(parser, name, parameter_section, constraint):
-    parser.parse_literal("""
+def test_type_parameter_constraints_with_value_range(parser, macros, name, parameter_section,
+                                                     constraint):
+    parser.parse_literal(MACROS[macros] + """
 tosca_definitions_version: tosca_simple_yaml_1_0
+{{- additions() }}
 data_types:
   MyDataType:
     properties:
@@ -242,27 +517,29 @@ data_types:
 {{ name }}_types:
 {%- endif %}
   MyType:
-    {{ parameter_section }}:
-      my_parameter:
-        type: MyDataType
-        constraints:
-          - {{ constraint }}:
-            - {my_field: string a}
-            - {my_field: string b}
+{%- call parameters() %}
+my_parameter:
+  type: MyDataType
+  constraints:
+    - {{ constraint }}:
+      - {my_field: string a}
+      - {my_field: string b}
+{% endcall %}
 """, dict(name=name, parameter_section=parameter_section, constraint=constraint)).assert_success()
 
 
 @pytest.mark.parametrize(
-    'name,parameter_section,constraint',
-    ((s[0], s[1], v)
+    'macros,name,parameter_section,constraint',
+    ((s[0], s[1], s[2], v)
      for s, v in itertools.product(
-         data.PARAMETER_WITH_CONSTRAINTS_SECTIONS,
+         PROPERTY_SECTIONS,
          data.CONSTRAINTS_WITH_VALUE_RANGE))
 )
-def test_type_parameter_constraints_with_value_range_too_many(parser, name, parameter_section,
-                                                              constraint):
-    parser.parse_literal("""
+def test_type_parameter_constraints_with_value_range_too_many(parser, macros, name,
+                                                              parameter_section, constraint):
+    parser.parse_literal(MACROS[macros] + """
 tosca_definitions_version: tosca_simple_yaml_1_0
+{{- additions() }}
 data_types:
   MyDataType:
     properties:
@@ -272,28 +549,30 @@ data_types:
 {{ name }}_types:
 {%- endif %}
   MyType:
-    {{ parameter_section }}:
-      my_parameter:
-        type: MyDataType
-        constraints:
-          - {{ constraint }}:
-            - {my_field: string a}
-            - {my_field: string b}
-            - {my_field: string c}
+{%- call parameters() %}
+my_parameter:
+  type: MyDataType
+  constraints:
+    - {{ constraint }}:
+      - {my_field: string a}
+      - {my_field: string b}
+      - {my_field: string c}
+{% endcall %}
 """, dict(name=name, parameter_section=parameter_section, constraint=constraint)).assert_failure()
 
 
 @pytest.mark.parametrize(
-    'name,parameter_section,constraint',
-    ((s[0], s[1], v)
+    'macros,name,parameter_section,constraint',
+    ((s[0], s[1], s[2], v)
      for s, v in itertools.product(
-         data.PARAMETER_WITH_CONSTRAINTS_SECTIONS,
+         PROPERTY_SECTIONS,
          data.CONSTRAINTS_WITH_VALUE_RANGE))
 )
-def test_type_parameter_constraints_with_value_range_invalid(parser, name, parameter_section,
-                                                             constraint):
-    parser.parse_literal("""
+def test_type_parameter_constraints_with_value_range_invalid(macros, parser, name,
+                                                             parameter_section, constraint):
+    parser.parse_literal(MACROS[macros] + """
 tosca_definitions_version: tosca_simple_yaml_1_0
+{{- additions() }}
 data_types:
   MyDataType:
     properties:
@@ -303,125 +582,144 @@ data_types:
 {{ name }}_types:
 {%- endif %}
   MyType:
-    {{ parameter_section }}:
-      my_parameter:
-        type: MyDataType
-        constraints:
-          - {{ constraint }}:
-            - {my_field: string b}
-            - {my_field: string a}
+{%- call parameters() %}
+my_parameter:
+  type: MyDataType
+  constraints:
+    - {{ constraint }}:
+      - {my_field: string b}
+      - {my_field: string a}
+{% endcall %}
 """, dict(name=name, parameter_section=parameter_section, constraint=constraint)).assert_failure()
 
 
-@pytest.mark.parametrize('name,parameter_section', data.PARAMETER_WITH_CONSTRAINTS_SECTIONS)
-def test_type_parameter_constraints_pattern(parser, name, parameter_section):
-    parser.parse_literal("""
+@pytest.mark.parametrize('macros,name,parameter_section', PROPERTY_SECTIONS)
+def test_type_parameter_constraints_pattern(parser, macros, name, parameter_section):
+    parser.parse_literal(MACROS[macros] + """
 tosca_definitions_version: tosca_simple_yaml_1_0
+{{- additions() }}
 {{ name }}_types:
   MyType:
-    {{ parameter_section }}:
-      my_parameter:
-        type: string
-        constraints:
-          - pattern: ^pattern$
+{%- call parameters() %}
+my_parameter:
+  type: string
+  constraints:
+    - pattern: ^pattern$
+{% endcall %}
 """, dict(name=name, parameter_section=parameter_section)).assert_success()
 
 
-@pytest.mark.parametrize('name,parameter_section', data.PARAMETER_WITH_CONSTRAINTS_SECTIONS)
-def test_type_parameter_constraints_pattern_bad(parser, name, parameter_section):
-    parser.parse_literal("""
+@pytest.mark.parametrize('macros,name,parameter_section', PROPERTY_SECTIONS)
+def test_type_parameter_constraints_pattern_bad(parser, macros, name, parameter_section):
+    parser.parse_literal(MACROS[macros] + """
 tosca_definitions_version: tosca_simple_yaml_1_0
+{{- additions() }}
 {{ name }}_types:
   MyType:
-    {{ parameter_section }}:
-      my_parameter:
-        type: string
-        constraints:
-          - pattern: (
+{%- call parameters() %}
+my_parameter:
+  type: string
+  constraints:
+    - pattern: (
+{% endcall %}
 """, dict(name=name, parameter_section=parameter_section)).assert_failure()
 
 
 @pytest.mark.parametrize(
-    'name,parameter_section,constraint',
-    ((s[0], s[1], v)
+    'macros,name,parameter_section,constraint',
+    ((s[0], s[1], s[2], v)
      for s, v in itertools.product(
-         data.PARAMETER_WITH_CONSTRAINTS_SECTIONS,
+         PROPERTY_SECTIONS,
          data.CONSTRAINTS_WITH_NON_NEGATIVE_INT))
 )
-def test_type_parameter_constraints_with_integer(parser, name, parameter_section, constraint):
-    parser.parse_literal("""
+def test_type_parameter_constraints_with_integer(parser, macros, name, parameter_section,
+                                                 constraint):
+    parser.parse_literal(MACROS[macros] + """
 tosca_definitions_version: tosca_simple_yaml_1_0
+{{- additions() }}
 {{ name }}_types:
   MyType:
-    {{ parameter_section }}:
-      my_parameter:
-        type: string
-        constraints:
-          - {{ constraint }}: 1
+{%- call parameters() %}
+my_parameter:
+  type: string
+  constraints:
+    - {{ constraint }}: 1
+{% endcall %}
 """, dict(name=name, parameter_section=parameter_section, constraint=constraint)).assert_success()
 
 
 @pytest.mark.parametrize(
-    'name,parameter_section,constraint',
-    ((s[0], s[1], v)
+    'macros,name,parameter_section,constraint',
+    ((s[0], s[1], s[2], v)
      for s, v in itertools.product(
-         data.PARAMETER_WITH_CONSTRAINTS_SECTIONS,
+         PROPERTY_SECTIONS,
          data.CONSTRAINTS_WITH_NON_NEGATIVE_INT))
 )
-def test_type_parameter_constraints_with_integer_bad(parser, name, parameter_section, constraint):
-    parser.parse_literal("""
+def test_type_parameter_constraints_with_integer_bad(parser, macros, name, parameter_section,
+                                                     constraint):
+    parser.parse_literal(MACROS[macros] + """
 tosca_definitions_version: tosca_simple_yaml_1_0
+{{- additions() }}
 {{ name }}_types:
   MyType:
-    {{ parameter_section }}:
-      my_parameter:
-        type: string
-        constraints:
-          - {{ constraint }}: -1
+{%- call parameters() %}
+my_parameter:
+  type: string
+  constraints:
+    - {{ constraint }}: -1
+{% endcall %}
 """, dict(name=name, parameter_section=parameter_section, constraint=constraint)).assert_failure()
 
 
 # Overriding
 
-@pytest.mark.parametrize('name,parameter_section', data.PARAMETER_SECTIONS)
-def test_type_parameter_add(parser, name, parameter_section):
-    parser.parse_literal("""
+@pytest.mark.parametrize('macros,name,parameter_section', PARAMETER_SECTIONS)
+def test_type_parameter_add(parser, macros, name, parameter_section):
+    parser.parse_literal(MACROS[macros] + """
 tosca_definitions_version: tosca_simple_yaml_1_0
+{{- additions() }}
 {{ name }}_types:
   MyType1:
-    {{ parameter_section }}:
-      my_parameter1:
-        type: string
+{%- call parameters() %}
+my_parameter1:
+  type: string
+{% endcall %}
   MyType2:
     derived_from: MyType1
-    {{ parameter_section }}:
-      my_parameter2:
-        type: string
+{%- call parameters() %}
+my_parameter2:
+  type: string
+{% endcall %}
 """, dict(name=name, parameter_section=parameter_section)).assert_success()
 
 
-@pytest.mark.parametrize('name,parameter_section', data.PARAMETER_SECTIONS)
-def test_type_parameter_add_default(parser, name, parameter_section):
-    parser.parse_literal("""
+@pytest.mark.parametrize('macros,name,parameter_section', PARAMETER_SECTIONS)
+def test_type_parameter_add_default(parser, macros, name, parameter_section):
+    parser.parse_literal(MACROS[macros] + """
 tosca_definitions_version: tosca_simple_yaml_1_0
+{{- additions() }}
 {{ name }}_types:
   MyType1:
-    {{ parameter_section }}:
-      my_parameter:
-        type: string
+{%- call parameters() %}
+my_parameter:
+  type: string
+{% endcall %}
   MyType2:
     derived_from: MyType1
-    {{ parameter_section }}:
-      my_parameter:
-        type: string
-        default: my value 
+{%- call parameters() %}
+my_parameter:
+  type: string
+  default: my value
+{% endcall %}
 """, dict(name=name, parameter_section=parameter_section)).assert_success()
 
 
-@pytest.mark.parametrize('name,parameter_section', data.PARAMETER_SECTIONS)
-def test_type_parameter_type_override(parser, name, parameter_section):
-    parser.parse_literal("""
+@pytest.mark.skip(reason='fix for node.capability and node.relationship')
+@pytest.mark.parametrize('macros,name,parameter_section', PARAMETER_SECTIONS)
+def test_type_parameter_type_override(parser, macros, name, parameter_section):
+    parser.parse_literal(MACROS[macros] + """
 tosca_definitions_version: tosca_simple_yaml_1_0
+{{- additions() }}
 data_types:
   MyDataType1: {}
   MyDataType2:
@@ -430,21 +728,25 @@ data_types:
 {{ name }}_types:
 {%- endif %}
   MyType1:
-    {{ parameter_section }}:
-      my_parameter:
-        type: MyDataType1
+{%- call parameters() %}
+my_parameter:
+  type: MyDataType1
+{% endcall %}
   MyType2:
     derived_from: MyType1
-    {{ parameter_section }}:
-      my_parameter:
-        type: MyDataType2
+{%- call parameters() %}
+my_parameter:
+  type: MyDataType2
+{% endcall %}
 """, dict(name=name, parameter_section=parameter_section)).assert_success()
 
 
-@pytest.mark.parametrize('name,parameter_section', data.PARAMETER_SECTIONS)
-def test_type_parameter_type_override_bad(parser, name, parameter_section):
-    parser.parse_literal("""
+@pytest.mark.skip(reason='fix for node.capability and node.relationship')
+@pytest.mark.parametrize('macros,name,parameter_section', PARAMETER_SECTIONS)
+def test_type_parameter_type_override_bad(parser, macros, name, parameter_section):
+    parser.parse_literal(MACROS[macros] + """
 tosca_definitions_version: tosca_simple_yaml_1_0
+{{- additions() }}
 data_types:
   MyDataType1: {}
   MyDataType2:
@@ -453,43 +755,49 @@ data_types:
 {{ name }}_types:
 {%- endif %}
   MyType1:
-    {{ parameter_section }}:
-      my_parameter:
-        type: MyDataType2
+{%- call parameters() %}
+my_parameter:
+  type: MyDataType2
+{% endcall %}
   MyType2:
     derived_from: MyType1
-    {{ parameter_section }}:
-      my_parameter:
-        type: MyDataType1
+{%- call parameters() %}
+my_parameter:
+  type: MyDataType1
+{% endcall %}
 """, dict(name=name, parameter_section=parameter_section)).assert_failure()
 
 
 # Unicode
 
-@pytest.mark.parametrize('name,parameter_section', data.PARAMETER_SECTIONS)
-def test_type_parameter_unicode(parser, name, parameter_section):
-    parser.parse_literal("""
+@pytest.mark.parametrize('macros,name,parameter_section', PARAMETER_SECTIONS)
+def test_type_parameter_unicode(parser, macros, name, parameter_section):
+    parser.parse_literal(MACROS[macros] + """
 tosca_definitions_version: tosca_simple_yaml_1_0
+{{- additions() }}
 {{ name }}_types:
   MyType:
-    {{ parameter_section }}:
-      參數:
-        type: string
-        description: 描述
-        default: 值
-        status: supported
+{%- call parameters() %}
+參數:
+  type: string
+  description: 描述
+  default: 值
+  status: supported
+{% endcall %}
 """, dict(name=name, parameter_section=parameter_section)).assert_success()
 
 
-@pytest.mark.parametrize('name,parameter_section', data.PARAMETER_WITH_CONSTRAINTS_SECTIONS)
-def test_type_parameter_constraints_pattern_unicode(parser, name, parameter_section):
-    parser.parse_literal("""
+@pytest.mark.parametrize('macros,name,parameter_section', PROPERTY_SECTIONS)
+def test_type_parameter_constraints_pattern_unicode(parser, macros, name, parameter_section):
+    parser.parse_literal(MACROS[macros] + """
 tosca_definitions_version: tosca_simple_yaml_1_0
+{{- additions() }}
 {{ name }}_types:
   類型:
-    {{ parameter_section }}:
-      參數:
-        type: string
-        constraints:
-          - pattern: ^模式$
+{%- call parameters() %}
+參數:
+  type: string
+  constraints:
+    - pattern: ^模式$
+{% endcall %}
 """, dict(name=name, parameter_section=parameter_section)).assert_success()

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/1d8ac549/tests/extensions/aria_extension_tosca/simple_v1_0/types/common/test_types.py
----------------------------------------------------------------------
diff --git a/tests/extensions/aria_extension_tosca/simple_v1_0/types/common/test_types.py b/tests/extensions/aria_extension_tosca/simple_v1_0/types/common/test_types.py
index d46a322..80a74ef 100644
--- a/tests/extensions/aria_extension_tosca/simple_v1_0/types/common/test_types.py
+++ b/tests/extensions/aria_extension_tosca/simple_v1_0/types/common/test_types.py
@@ -54,38 +54,64 @@ tosca_definitions_version: tosca_simple_yaml_1_0
 """, dict(name=name)).assert_success()
 
 
+# Description
+
 @pytest.mark.parametrize('name,value', itertools.product(
     data.TYPE_NAMES,
     data.NOT_A_STRING
 ))
-def test_type_derived_from_wrong_yaml_type(parser, name, value):
+def test_type_description_wrong_yaml_type(parser, name, value):
     parser.parse_literal("""
 tosca_definitions_version: tosca_simple_yaml_1_0
 {{ name }}_types:
   MyType:
-    derived_from: {{ value }}
+    description: {{ value }}
 """, dict(name=name, value=value)).assert_failure()
 
 
+@pytest.mark.parametrize('name', data.TYPE_NAMES)
+def test_type_description(parser, name):
+    parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+{{ name }}_types:
+  MyType:
+    description: a description
+""", dict(name=name)).assert_success()
+
+
 # Derived from
 
-@pytest.mark.parametrize('name', data.TYPE_NAMES)
-def test_type_derived_from_unknown(parser, name):
+@pytest.mark.parametrize('name,value', itertools.product(
+    data.TYPE_NAMES,
+    data.NOT_A_STRING
+))
+def test_type_derived_from_wrong_yaml_type(parser, name, value):
     parser.parse_literal("""
 tosca_definitions_version: tosca_simple_yaml_1_0
 {{ name }}_types:
   MyType:
-    derived_from: UnknownType
-""", dict(name=name)).assert_failure()
+    derived_from: {{ value }}
+""", dict(name=name, value=value)).assert_failure()
+
+
+@pytest.mark.parametrize('name', data.TYPE_NAMES)
+def test_type_derived_from(parser, name):
+    parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+{{ name }}_types:
+  MyType1: {}
+  MyType2:
+    derived_from: MyType1
+""", dict(name=name)).assert_success()
 
 
 @pytest.mark.parametrize('name', data.TYPE_NAMES)
-def test_type_derived_from_null(parser, name):
+def test_type_derived_from_unknown(parser, name):
     parser.parse_literal("""
 tosca_definitions_version: tosca_simple_yaml_1_0
 {{ name }}_types:
   MyType:
-    derived_from: null
+    derived_from: UnknownType
 """, dict(name=name)).assert_failure()
 
 
@@ -113,37 +139,26 @@ tosca_definitions_version: tosca_simple_yaml_1_0
 """, dict(name=name)).assert_failure()
 
 
-@pytest.mark.parametrize('name', data.TYPE_NAMES)
-def test_type_derived_from_root(parser, name):
-    parser.parse_literal("""
-tosca_definitions_version: tosca_simple_yaml_1_0
-{{ name }}_types:
-  MyType1: {}
-  MyType2:
-    derived_from: MyType1
-""", dict(name=name)).assert_success()
-
-
-# Common fields
+# Version
 
-@pytest.mark.parametrize('name', data.TYPE_NAMES)
-def test_type_fields(parser, name):
+@pytest.mark.parametrize('name,value', itertools.product(
+    data.TYPE_NAMES,
+    data.GOOD_VERSIONS
+))
+def test_type_version(parser, name, value):
     parser.parse_literal("""
 tosca_definitions_version: tosca_simple_yaml_1_0
 {{ name }}_types:
-  MyType1: {}
-  MyType2:
-    derived_from: MyType1
-    version: 1.0.0
-    description: a description
-""", dict(name=name)).assert_success()
+  MyType:
+    version: {{ value }}
+""", dict(name=name, value=value)).assert_success()
 
 
 @pytest.mark.parametrize('name,value', itertools.product(
     data.TYPE_NAMES,
     data.BAD_VERSIONS
 ))
-def test_type_bad_version(parser, name, value):
+def test_type_version_bad(parser, name, value):
     parser.parse_literal("""
 tosca_definitions_version: tosca_simple_yaml_1_0
 {{ name }}_types:

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/1d8ac549/tests/extensions/aria_extension_tosca/simple_v1_0/types/node_types/test_node_type_capabilities.py
----------------------------------------------------------------------
diff --git a/tests/extensions/aria_extension_tosca/simple_v1_0/types/node_types/test_node_type_capabilities.py b/tests/extensions/aria_extension_tosca/simple_v1_0/types/node_types/test_node_type_capabilities.py
index d3de459..5651fe6 100644
--- a/tests/extensions/aria_extension_tosca/simple_v1_0/types/node_types/test_node_type_capabilities.py
+++ b/tests/extensions/aria_extension_tosca/simple_v1_0/types/node_types/test_node_type_capabilities.py
@@ -14,8 +14,6 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-import itertools
-
 import pytest
 
 from ... import data
@@ -57,7 +55,24 @@ node_types:
 """).assert_failure()
 
 
-def test_node_type_capability_fields(parser):
+# Description
+
+@pytest.mark.parametrize('value', data.NOT_A_STRING)
+def test_node_type_capability_description_wrong_yaml_type(parser, value):
+    parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+capability_types:
+  MyType: {}
+node_types:
+  MyType:
+    capabilities:
+      my_capability:
+        type: MyType
+        description: {{ value }}
+""", dict(value=value)).assert_failure()
+
+
+def test_node_type_capability_description(parser):
     parser.parse_literal("""
 tosca_definitions_version: tosca_simple_yaml_1_0
 capability_types:
@@ -68,34 +83,31 @@ node_types:
       my_capability:
         type: MyType
         description: a description
-        properties: {}
-        attributes: {}
-        valid_source_types: []
-        occurrences: [ 0, UNBOUNDED ]
 """).assert_success()
 
 
 # Type
 
-def test_node_type_capability_type_unknown(parser):
+@pytest.mark.parametrize('value', data.NOT_A_STRING)
+def test_node_type_capability_type_wrong_yaml_type(parser, value):
     parser.parse_literal("""
 tosca_definitions_version: tosca_simple_yaml_1_0
 node_types:
   MyType:
     capabilities:
       my_capability:
-        type: UnknownType
-""").assert_failure()
+        type: {{ value }}
+""", dict(value=value)).assert_failure()
 
 
-def test_node_type_capability_type_null(parser):
+def test_node_type_capability_type_unknown(parser):
     parser.parse_literal("""
 tosca_definitions_version: tosca_simple_yaml_1_0
 node_types:
   MyType:
     capabilities:
       my_capability:
-        type: null
+        type: UnknownType
 """).assert_failure()
 
 
@@ -139,157 +151,6 @@ node_types:
 """).assert_failure()
 
 
-# Parameters
-
-@pytest.mark.parametrize('parameter_section', data.PARAMETER_SECTION_NAMES)
-def test_node_type_capability_parameter_fields(parser, parameter_section):
-    parser.parse_literal("""
-tosca_definitions_version: tosca_simple_yaml_1_0
-capability_types:
-  MyType: {}
-node_types:
-  MyType:
-    capabilities:
-      my_capability:
-        type: MyType
-        {{ parameter_section }}:
-          my_parameter:
-            type: string
-            description: a description
-            default: a value
-            status: supported
-""", dict(parameter_section=parameter_section)).assert_success()
-
-
-@pytest.mark.parametrize('parameter_section,value', itertools.product(
-    data.PARAMETER_SECTION_NAMES,
-    data.STATUSES
-))
-def test_node_type_capability_parameter_status(parser, parameter_section, value):
-    parser.parse_literal("""
-tosca_definitions_version: tosca_simple_yaml_1_0
-capability_types:
-  MyType: {}
-node_types:
-  MyType:
-    capabilities:
-      my_capability:
-        type: MyType
-        {{ parameter_section }}:
-          my_parameter:
-            type: string
-            status: {{ value }}
-""", dict(parameter_section=parameter_section, value=value)).assert_success()
-
-
-@pytest.mark.parametrize('parameter_section', data.PARAMETER_SECTION_NAMES)
-def test_node_type_capability_parameter_status_bad(parser, parameter_section):
-    parser.parse_literal("""
-tosca_definitions_version: tosca_simple_yaml_1_0
-capability_types:
-  MyType: {}
-node_types:
-  MyType:
-    capabilities:
-      my_capability:
-        type: MyType
-        {{ parameter_section }}:
-          my_parameter:
-            type: string
-            status: not a status
-""", dict(parameter_section=parameter_section)).assert_failure()
-
-
-@pytest.mark.parametrize('parameter_section', data.PARAMETER_SECTION_NAMES)
-def test_node_type_capability_parameter_add(parser, parameter_section):
-    parser.parse_literal("""
-tosca_definitions_version: tosca_simple_yaml_1_0
-capability_types:
-  MyType:
-    {{ parameter_section }}:
-      my_parameter1:
-        type: string
-node_types:
-  MyType:
-    capabilities:
-      my_capability:
-        type: MyType
-        {{ parameter_section }}:
-          my_parameter2:
-            type: string
-""", dict(parameter_section=parameter_section)).assert_success()
-
-
-@pytest.mark.parametrize('parameter_section', data.PARAMETER_SECTION_NAMES)
-def test_node_type_capability_parameter_add_default(parser, parameter_section):
-    parser.parse_literal("""
-tosca_definitions_version: tosca_simple_yaml_1_0
-capability_types:
-  MyType:
-    {{ parameter_section }}:
-      my_parameter:
-        type: string
-node_types:
-  MyType:
-    capabilities:
-      my_capability:
-        type: MyType
-        {{ parameter_section }}:
-          my_parameter:
-            type: string
-            default: my value
-""", dict(parameter_section=parameter_section)).assert_success()
-
-
-@pytest.mark.parametrize('parameter_section', data.PARAMETER_SECTION_NAMES)
-def test_node_type_capability_parameter_type_override(parser, parameter_section):
-    parser.parse_literal("""
-tosca_definitions_version: tosca_simple_yaml_1_0
-data_types:
-  MyType1: {}
-  MyType2:
-    derived_from: MyType1
-capability_types:
-  MyType:
-    {{ parameter_section }}:
-      my_parameter:
-        type: MyType1
-node_types:
-  MyType:
-    capabilities:
-      my_capability:
-        type: MyType
-        {{ parameter_section }}:
-          my_parameter:
-            type: MyType2
-""", dict(parameter_section=parameter_section)).assert_success()
-
-
-@pytest.mark.skip(reason='fix')
-@pytest.mark.parametrize('parameter_section', data.PARAMETER_SECTION_NAMES)
-def test_node_type_capability_parameter_type_override_bad(parser, parameter_section):
-    parser.parse_literal("""
-tosca_definitions_version: tosca_simple_yaml_1_0
-data_types:
-  MyType1: {}
-  MyType2:
-    derived_from: MyType1
-capability_types:
-  MyType:
-    {{ parameter_section }}:
-      my_parameter:
-        type: MyType2
-node_types:
-  MyType:
-    capabilities:
-      my_capability:
-        type: MyType
-        {{ parameter_section }}:
-          my_parameter:
-            type: MyType1
-""", dict(parameter_section=parameter_section)).assert_failure()
-
-
 # Valid source types
 
 def test_node_type_capability_valid_source_types(parser):
@@ -351,8 +212,6 @@ node_types:
 """).assert_success()
 
 
-
-
 def test_node_type_capability_valid_source_types_unknown(parser):
     parser.parse_literal("""
 tosca_definitions_version: tosca_simple_yaml_1_0
@@ -369,7 +228,7 @@ node_types:
 
 # Occurrences
 
-@pytest.mark.parametrize('value', data.NOT_OCCURRENCES)
+@pytest.mark.parametrize('value', data.OCCURRENCES)
 def test_node_type_capability_occurrences(parser, value):
     parser.parse_literal("""
 tosca_definitions_version: tosca_simple_yaml_1_0
@@ -381,6 +240,21 @@ node_types:
       my_capability:
         type: MyType
         occurrences: {{ value }}
+""", dict(value=value)).assert_success()
+
+
+@pytest.mark.parametrize('value', data.BAD_OCCURRENCES)
+def test_node_type_capability_occurrences_bad(parser, value):
+    parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+capability_types:
+  MyType: {}
+node_types:
+  MyType:
+    capabilities:
+      my_capability:
+        type: MyType
+        occurrences: {{ value }}
 """, dict(value=value)).assert_failure()
 
 

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/1d8ac549/tests/extensions/aria_extension_tosca/simple_v1_0/types/node_types/test_node_type_relationship_interfaces.py
----------------------------------------------------------------------
diff --git a/tests/extensions/aria_extension_tosca/simple_v1_0/types/node_types/test_node_type_relationship_interfaces.py b/tests/extensions/aria_extension_tosca/simple_v1_0/types/node_types/test_node_type_relationship_interfaces.py
index c369328..ee34a3a 100644
--- a/tests/extensions/aria_extension_tosca/simple_v1_0/types/node_types/test_node_type_relationship_interfaces.py
+++ b/tests/extensions/aria_extension_tosca/simple_v1_0/types/node_types/test_node_type_relationship_interfaces.py
@@ -15,128 +15,15 @@
 # limitations under the License.
 
 """
-Developer note: make sure that these tests mirror those in:
- test_interface_type.py,
- test_type_interfaces.py.
+These tests are in addition to those in common/test_type_interface.py.
 """
 
 import pytest
 
-from ... import data
-
-
-# Syntax
-
-@pytest.mark.parametrize('value', data.NOT_A_DICT)
-def test_node_type_relationship_interface_wrong_yaml_type(parser, value):
-    parser.parse_literal("""
-tosca_definitions_version: tosca_simple_yaml_1_0
-capability_types:
-  MyType: {}
-relationship_types:
-  MyType: {}
-interface_types:
-  MyType: {}
-node_types:
-  MyType:
-    requirements:
-      - my_requirement:
-          capability: MyType
-          relationship:
-            type: MyType
-            interfaces:
-              my_interface: {{ value }}
-""", dict(value=value)).assert_failure()
-
-
-def test_node_type_relationship_interface_unsupported_field(parser):
-    parser.parse_literal("""
-tosca_definitions_version: tosca_simple_yaml_1_0
-capability_types:
-  MyType: {}
-node_types:
-  MyType:
-    requirements:
-      - my_requirement:
-          capability: MyType
-          unsupported: {}
-""").assert_failure()
-
-
-def test_node_type_relationship_interface_empty(parser):
-    parser.parse_literal("""
-tosca_definitions_version: tosca_simple_yaml_1_0
-capability_types:
-  MyType: {}
-relationship_types:
-  MyType: {}
-node_types:
-  MyType:
-    requirements:
-      - my_requirement:
-          capability: MyType
-          relationship:
-            type: MyType
-            interfaces:
-              my_interface: {} # "type" is required
-""").assert_failure()
-
-
-def test_node_type_relationship_interface_fields(parser):
-    parser.parse_literal("""
-tosca_definitions_version: tosca_simple_yaml_1_0
-capability_types:
-  MyType: {}
-relationship_types:
-  MyType: {}
-interface_types:
-  MyType: {}
-node_types:
-  MyType:
-    requirements:
-      - my_requirement:
-          capability: MyType
-          relationship:
-            type: MyType
-            interfaces:
-              my_interface:
-                type: MyType
-                inputs: {}
-                my_operation1: {}
-                my_operation2: {}
-""").assert_success()
-
 
 # Type
 
-def test_node_type_relationship_interface_type_override1(parser):
-    parser.parse_literal("""
-tosca_definitions_version: tosca_simple_yaml_1_0
-capability_types:
-  MyType: {}
-relationship_types:
-  MyType:
-    interfaces:
-      my_interface:
-        type: MyType1
-interface_types:
-  MyType1: {}
-  MyType2:
-    derived_from: MyType1
-node_types:
-  MyType:
-    requirements:
-      - my_requirement:
-          capability: MyType
-          relationship:
-            type: MyType
-            interfaces:
-              my_interface:
-                type: MyType2
-""").assert_success()
-
-
-def test_node_type_relationship_interface_type_override2(parser):
+def test_node_type_relationship_interface_type_override(parser):
     parser.parse_literal("""
 tosca_definitions_version: tosca_simple_yaml_1_0
 capability_types:
@@ -171,35 +58,7 @@ node_types:
 
 
 @pytest.mark.skip(reason='fix')
-def test_node_type_relationship_interface_type_override1_bad(parser):
-    parser.parse_literal("""
-tosca_definitions_version: tosca_simple_yaml_1_0
-capability_types:
-  MyType: {}
-relationship_types:
-  MyType:
-    interfaces:
-      my_interface:
-        type: MyType2
-interface_types:
-  MyType1: {}
-  MyType2:
-    derived_from: MyType1
-node_types:
-  MyType:
-    requirements:
-      - my_requirement:
-          capability: MyType
-          relationship:
-            type: MyType
-            interfaces:
-              my_interface:
-                type: MyType1
-""").assert_failure()
-
-
-@pytest.mark.skip(reason='fix')
-def test_node_type_relationship_interface_type_override2_bad(parser):
+def test_node_type_relationship_interface_type_override_bad(parser):
     parser.parse_literal("""
 tosca_definitions_version: tosca_simple_yaml_1_0
 capability_types:
@@ -231,438 +90,3 @@ node_types:
               my_interface:
                 type: MyType1
 """).assert_failure()
-
-
-# Interface inputs
-
-def test_node_type_relationship_interface_inputs_add(parser):
-    parser.parse_literal("""
-tosca_definitions_version: tosca_simple_yaml_1_0
-capability_types:
-  MyType: {}
-relationship_types:
-  MyType: {}
-interface_types:
-  MyType:
-    inputs:
-      my_input1:
-        type: string
-node_types:
-  MyType:
-    requirements:
-      - my_requirement:
-          capability: MyType
-          relationship:
-            type: MyType
-            interfaces:
-              my_interface:
-                type: MyType
-                inputs:
-                  my_input2:
-                    type: string
-""").assert_success()
-
-
-def test_node_type_relationship_interface_inputs_type_override_same(parser):
-    parser.parse_literal("""
-tosca_definitions_version: tosca_simple_yaml_1_0
-capability_types:
-  MyType: {}
-relationship_types:
-  MyType: {}
-interface_types:
-  MyType:
-    inputs:
-      my_input:
-        type: string
-node_types:
-  MyType:
-    requirements:
-      - my_requirement:
-          capability: MyType
-          relationship:
-            type: MyType
-            interfaces:
-              my_interface:
-                type: MyType
-                inputs:
-                  my_input:
-                    type: string
-""").assert_success()
-
-
-def test_node_type_relationship_interface_inputs_type_override_derived(parser):
-    parser.parse_literal("""
-tosca_definitions_version: tosca_simple_yaml_1_0
-capability_types:
-  MyType: {}
-relationship_types:
-  MyType: {}
-data_types:
-  MyType1: {}
-  MyType2:
-    derived_from: MyType1
-interface_types:
-  MyType:
-    inputs:
-      my_input:
-        type: MyType1
-node_types:
-  MyType:
-    requirements:
-      - my_requirement:
-          capability: MyType
-          relationship:
-            type: MyType
-            interfaces:
-              my_interface:
-                type: MyType
-                inputs:
-                  my_input:
-                    type: MyType2
-""").assert_success()
-
-
-@pytest.mark.skip(reason='fix')
-def test_node_type_relationship_interface_inputs_type_override_bad(parser):
-    parser.parse_literal("""
-tosca_definitions_version: tosca_simple_yaml_1_0
-capability_types:
-  MyType: {}
-relationship_types:
-  MyType: {}
-data_types:
-  MyType1: {}
-  MyType2:
-    derived_from: MyType1
-interface_types:
-  MyType:
-    inputs:
-      my_input:
-        type: MyType2
-node_types:
-  MyType:
-    requirements:
-      - my_requirement:
-          capability: MyType
-          relationship:
-            type: MyType
-            interfaces:
-              my_interface:
-                type: MyType
-                inputs:
-                  my_input:
-                    type: MyType1
-""").assert_failure()
-
-
-# Operations
-
-def test_node_type_relationship_interface_operation_empty(parser):
-    parser.parse_literal("""
-tosca_definitions_version: tosca_simple_yaml_1_0
-capability_types:
-  MyType: {}
-relationship_types:
-  MyType: {}
-interface_types:
-  MyType: {}
-node_types:
-  MyType:
-    requirements:
-      - my_requirement:
-          capability: MyType
-          relationship:
-            type: MyType
-            interfaces:
-              my_interface:
-                type: MyType
-                my_operation: {}
-""").assert_success()
-
-
-def test_node_type_relationship_interface_operation_fields(parser):
-    parser.parse_literal("""
-tosca_definitions_version: tosca_simple_yaml_1_0
-capability_types:
-  MyType: {}
-relationship_types:
-  MyType: {}
-interface_types:
-  MyType: {}
-node_types:
-  MyType:
-    requirements:
-      - my_requirement:
-          capability: MyType
-          relationship:
-            type: MyType
-            interfaces:
-              my_interface:
-                type: MyType
-                my_operation:
-                  description: a description
-                  implementation: {}
-                  inputs: {}
-""").assert_success()
-
-
-# Operation implementation
-
-def test_node_type_relationship_interface_operation_implementation_short_form(parser):
-    parser.parse_literal("""
-tosca_definitions_version: tosca_simple_yaml_1_0
-capability_types:
-  MyType: {}
-relationship_types:
-  MyType: {}
-interface_types:
-  MyType: {}
-node_types:
-  MyType:
-    requirements:
-      - my_requirement:
-          capability: MyType
-          relationship:
-            type: MyType
-            interfaces:
-              my_interface:
-                type: MyType
-                my_operation:
-                  implementation: an implementation
-""").assert_success()
-
-
-def test_node_type_relationship_interface_operation_implementation_long_form(parser):
-    parser.parse_literal("""
-tosca_definitions_version: tosca_simple_yaml_1_0
-capability_types:
-  MyType: {}
-relationship_types:
-  MyType: {}
-interface_types:
-  MyType: {}
-node_types:
-  MyType:
-    requirements:
-      - my_requirement:
-          capability: MyType
-          relationship:
-            type: MyType
-            interfaces:
-              my_interface:
-                type: MyType
-                my_operation:
-                  implementation:
-                    primary: an implementation
-                    dependencies:
-                      - a dependency
-                      - another dependency
-""").assert_success()
-
-
-@pytest.mark.parametrize('value', data.NOT_A_STRING)
-def test_node_type_relationship_interface_operation_implementation_wrong_yaml_type(parser, value):
-    parser.parse_literal("""
-tosca_definitions_version: tosca_simple_yaml_1_0
-capability_types:
-  MyType: {}
-relationship_types:
-  MyType: {}
-interface_types:
-  MyType: {}
-node_types:
-  MyType:
-    requirements:
-      - my_requirement:
-          capability: MyType
-          relationship:
-            type: MyType
-            interfaces:
-              my_interface:
-                type: MyType
-                my_operation:
-                  implementation:
-                    primary: {{ value }}
-""", dict(value=value)).assert_failure()
-
-
-@pytest.mark.parametrize('value', data.NOT_A_STRING)
-def test_node_type_relationship_interface_operation_dependencies_wrong_yaml_type(parser, value):
-    parser.parse_literal("""
-tosca_definitions_version: tosca_simple_yaml_1_0
-capability_types:
-  MyType: {}
-relationship_types:
-  MyType: {}
-interface_types:
-  MyType: {}
-node_types:
-  MyType:
-    requirements:
-      - my_requirement:
-          capability: MyType
-          relationship:
-            type: MyType
-            interfaces:
-              my_interface:
-                type: MyType
-                my_operation:
-                  implementation:
-                    primary: an implementation
-                    dependencies:
-                      - {{ value }}
-""", dict(value=value)).assert_failure()
-
-
-# Operation inputs
-
-def test_node_type_relationship_interface_operation_inputs_add(parser):
-    parser.parse_literal("""
-tosca_definitions_version: tosca_simple_yaml_1_0
-capability_types:
-  MyType: {}
-relationship_types:
-  MyType: {}
-interface_types:
-  MyType:
-    inputs:
-      my_input1:
-        type: string
-node_types:
-  MyType:
-    requirements:
-      - my_requirement:
-          capability: MyType
-          relationship:
-            type: MyType
-            interfaces:
-              my_interface:
-                type: MyType
-                my_operation:
-                  inputs:
-                    my_input2:
-                      type: string
-""").assert_success()
-
-
-def test_node_type_relationship_interface_operation_inputs_override_same_type(parser):
-    parser.parse_literal("""
-tosca_definitions_version: tosca_simple_yaml_1_0
-capability_types:
-  MyType: {}
-relationship_types:
-  MyType: {}
-interface_types:
-  MyType:
-    inputs:
-      my_input:
-        type: string
-node_types:
-  MyType:
-    requirements:
-      - my_requirement:
-          capability: MyType
-          relationship:
-            type: MyType
-            interfaces:
-              my_interface:
-                type: MyType
-                my_operation:
-                  inputs:
-                    my_input:
-                      type: string
-""").assert_success()
-
-
-def test_node_type_relationship_interface_operation_inputs_override_derived_type(parser):
-    parser.parse_literal("""
-tosca_definitions_version: tosca_simple_yaml_1_0
-capability_types:
-  MyType: {}
-relationship_types:
-  MyType: {}
-data_types:
-  MyType1: {}
-  MyType2:
-    derived_from: MyType1
-interface_types:
-  MyType:
-    inputs:
-      my_input:
-        type: MyType1
-node_types:
-  MyType:
-    requirements:
-      - my_requirement:
-          capability: MyType
-          relationship:
-            type: MyType
-            interfaces:
-              my_interface:
-                type: MyType
-                my_operation:
-                  inputs:
-                    my_input:
-                      type: MyType2
-""").assert_success()
-
-
-@pytest.mark.skip(reason='fix')
-def test_node_type_relationship_interface_operation_inputs_override_bad(parser):
-    parser.parse_literal("""
-tosca_definitions_version: tosca_simple_yaml_1_0
-capability_types:
-  MyType: {}
-relationship_types:
-  MyType: {}
-data_types:
-  MyType1: {}
-  MyType2:
-    derived_from: MyType1
-interface_types:
-  MyType:
-    inputs:
-      my_input:
-        type: MyType2
-node_types:
-  MyType:
-    requirements:
-      - my_requirement:
-          capability: MyType
-          relationship:
-            type: MyType
-            interfaces:
-              my_interface:
-                type: MyType
-                my_operation:
-                  inputs:
-                    my_input:
-                      type: MyType1
-""").assert_failure()
-
-
-# Unicode
-
-def test_node_type_relationship_interface_unicode(parser):
-    parser.parse_literal("""
-tosca_definitions_version: tosca_simple_yaml_1_0
-capability_types:
-  類型: {}
-relationship_types:
-  類型: {}
-interface_types:
-  類型: {}
-node_types:
-  類型:
-    requirements:
-      - 需求:
-          capability: 類型
-          relationship:
-            type: 類型
-            interfaces:
-              接口:
-                type: 類型
-                手術:
-                  implementation: 履行
-""").assert_success()

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/1d8ac549/tests/extensions/aria_extension_tosca/simple_v1_0/types/node_types/test_node_type_requirements.py
----------------------------------------------------------------------
diff --git a/tests/extensions/aria_extension_tosca/simple_v1_0/types/node_types/test_node_type_requirements.py b/tests/extensions/aria_extension_tosca/simple_v1_0/types/node_types/test_node_type_requirements.py
index 2f3e6a5..f2a2fa4 100644
--- a/tests/extensions/aria_extension_tosca/simple_v1_0/types/node_types/test_node_type_requirements.py
+++ b/tests/extensions/aria_extension_tosca/simple_v1_0/types/node_types/test_node_type_requirements.py
@@ -32,6 +32,20 @@ node_types:
 """, dict(value=value)).assert_failure()
 
 
+def test_node_type_requirement_unsupported_field(parser):
+    parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+capability_types:
+  MyType: {}
+node_types:
+  MyType:
+    requirements:
+      - my_requirement:
+          capability: MyType
+          unsupported: {}
+""").assert_failure()
+
+
 def test_node_type_requirement_empty(parser):
     parser.parse_literal("""
 tosca_definitions_version: tosca_simple_yaml_1_0
@@ -42,28 +56,21 @@ node_types:
 """).assert_failure()
 
 
-def test_node_type_requirement_fields(parser):
+# Capability
+
+@pytest.mark.parametrize('value', data.NOT_A_DICT_OR_STRING)
+def test_node_type_requirement_capability_wrong_yaml_type(parser, value):
     parser.parse_literal("""
 tosca_definitions_version: tosca_simple_yaml_1_0
-capability_types:
-  MyType: {}
-relationship_types:
-  MyType: {}
 node_types:
   MyType:
     requirements:
       - my_requirement:
-          capability: MyType
-          node: MyType
-          relationship:
-            type: MyType
-          occurrences: [ 0, UNBOUNDED ]
-""").assert_success()
-
+          capability: {{ value }}
+""", dict(value=value)).assert_failure()
 
-# Capability
 
-def test_node_type_requirement_capability_short_form(parser):
+def test_node_type_requirement_capability_unsupported_field(parser):
     parser.parse_literal("""
 tosca_definitions_version: tosca_simple_yaml_1_0
 capability_types:
@@ -71,33 +78,36 @@ capability_types:
 node_types:
   MyType:
     requirements:
-      - my_requirement: MyType
-""").assert_success()
+      - my_requirement:
+          capability:
+            unsupported: {}
+""").assert_failure()
 
 
-def test_node_type_requirement_capability_unknown(parser):
+def test_node_type_requirement_capability_short_form(parser):
     parser.parse_literal("""
 tosca_definitions_version: tosca_simple_yaml_1_0
+capability_types:
+  MyType: {}
 node_types:
   MyType:
     requirements:
-      - my_requirement:
-          capability: UnknownType
-""").assert_failure()
+      - my_requirement: MyType
+""").assert_success()
 
 
-def test_node_type_requirement_capability_null(parser):
+def test_node_type_requirement_capability_type_unknown(parser):
     parser.parse_literal("""
 tosca_definitions_version: tosca_simple_yaml_1_0
 node_types:
   MyType:
     requirements:
       - my_requirement:
-          capability: null
+          capability: UnknownType
 """).assert_failure()
 
 
-def test_node_type_requirement_capability_override(parser):
+def test_node_type_requirement_capability_type_override(parser):
     parser.parse_literal("""
 tosca_definitions_version: tosca_simple_yaml_1_0
 capability_types:
@@ -118,7 +128,8 @@ node_types:
 
 # Node
 
-def test_node_type_requirement_node_unknown(parser):
+@pytest.mark.parametrize('value', data.NOT_A_STRING)
+def test_node_type_requirement_node_wrong_yaml_type(parser, value):
     parser.parse_literal("""
 tosca_definitions_version: tosca_simple_yaml_1_0
 capability_types:
@@ -128,11 +139,11 @@ node_types:
     requirements:
       - my_requirement:
           capability: MyType
-          node: UnknownType
-""").assert_failure()
+          node: {{ value }}
+""", dict(value=value)).assert_failure()
 
 
-def test_node_type_requirement_node_null(parser):
+def test_node_type_requirement_node_unknown(parser):
     parser.parse_literal("""
 tosca_definitions_version: tosca_simple_yaml_1_0
 capability_types:
@@ -142,7 +153,7 @@ node_types:
     requirements:
       - my_requirement:
           capability: MyType
-          node: null
+          node: UnknownType
 """).assert_failure()
 
 
@@ -170,7 +181,22 @@ node_types:
 
 # Relationship
 
-def test_node_type_requirement_relationship_type_unknown(parser):
+@pytest.mark.parametrize('value', data.NOT_A_DICT_OR_STRING)
+def test_node_type_requirement_relationship_type_wrong_yaml_type(parser, value):
+    parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+capability_types:
+  MyType: {}
+node_types:
+  MyType:
+    requirements:
+      - my_requirement:
+          capability: MyType
+          relationship: {{ value }}
+""", dict(value=value)).assert_failure()
+
+
+def test_node_type_requirement_relationship_unsupported_field(parser):
     parser.parse_literal("""
 tosca_definitions_version: tosca_simple_yaml_1_0
 capability_types:
@@ -181,11 +207,27 @@ node_types:
       - my_requirement:
           capability: MyType
           relationship:
-            type: UnknownType
+            unsupported: {}
 """).assert_failure()
 
 
-def test_node_type_requirement_relationship_type_null(parser):
+def test_node_type_requirement_relationship_short_form(parser):
+    parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+capability_types:
+  MyType: {}
+relationship_types:
+  MyType: {}
+node_types:
+  MyType:
+    requirements:
+      - my_requirement:
+          capability: MyType
+          relationship: MyType
+""").assert_success()
+
+
+def test_node_type_requirement_relationship_type_unknown(parser):
     parser.parse_literal("""
 tosca_definitions_version: tosca_simple_yaml_1_0
 capability_types:
@@ -196,7 +238,7 @@ node_types:
       - my_requirement:
           capability: MyType
           relationship:
-            type: null
+            type: UnknownType
 """).assert_failure()
 
 
@@ -227,7 +269,7 @@ node_types:
 
 # Occurrences
 
-@pytest.mark.parametrize('value', data.NOT_OCCURRENCES)
+@pytest.mark.parametrize('value', data.OCCURRENCES)
 def test_node_type_requirement_occurrences(parser, value):
     parser.parse_literal("""
 tosca_definitions_version: tosca_simple_yaml_1_0
@@ -237,7 +279,22 @@ node_types:
   MyType:
     requirements:
       - my_requirement:
-          type: MyType
+          capability: MyType
+          occurrences: {{ value }}
+""", dict(value=value)).assert_success()
+
+
+@pytest.mark.parametrize('value', data.BAD_OCCURRENCES)
+def test_node_type_requirement_occurrences_bad(parser, value):
+    parser.parse_literal("""
+tosca_definitions_version: tosca_simple_yaml_1_0
+capability_types:
+  MyType: {}
+node_types:
+  MyType:
+    requirements:
+      - my_requirement:
+          capability: MyType
           occurrences: {{ value }}
 """, dict(value=value)).assert_failure()
 

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/1d8ac549/tests/extensions/aria_extension_tosca/simple_v1_0/types/test_interface_type.py
----------------------------------------------------------------------
diff --git a/tests/extensions/aria_extension_tosca/simple_v1_0/types/test_interface_type.py b/tests/extensions/aria_extension_tosca/simple_v1_0/types/test_interface_type.py
index 38669c0..c185fa0 100644
--- a/tests/extensions/aria_extension_tosca/simple_v1_0/types/test_interface_type.py
+++ b/tests/extensions/aria_extension_tosca/simple_v1_0/types/test_interface_type.py
@@ -14,113 +14,42 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-
-"""
-Developer note: make sure that these tests mirror those in:
- test_type_interfaces.py,
- test_node_type_relationship_interfaces.py.
-"""
-
 import pytest
 
 from .. import data
 
 
-# Interface inputs
-
-def test_interface_type_inputs_add(parser):
-    parser.parse_literal("""
-tosca_definitions_version: tosca_simple_yaml_1_0
-interface_types:
-  MyType1:
-    inputs:
-      my_input1:
-        type: string
-  MyType2:
-    derived_from: MyType1
-    inputs:
-      my_input2:
-        type: string
-""").assert_success()
-
-
-def test_interface_type_inputs_type_override_same(parser):
-    parser.parse_literal("""
-tosca_definitions_version: tosca_simple_yaml_1_0
-interface_types:
-  MyType1:
-    inputs:
-      my_input:
-        type: string
-  MyType2:
-    derived_from: MyType1
-    inputs:
-      my_input:
-        type: string
-""").assert_success()
-
+# Operations
 
-def test_interface_type_inputs_type_override_derived(parser):
+def test_interface_type_operation_empty(parser):
     parser.parse_literal("""
 tosca_definitions_version: tosca_simple_yaml_1_0
-data_types:
-  MyType1: {}
-  MyType2:
-    derived_from: MyType1
 interface_types:
-  MyType1:
-    inputs:
-      my_input:
-        type: MyType1
-  MyType2:
-    derived_from: MyType1
-    inputs:
-      my_input:
-        type: MyType2
+  MyType:
+    my_operation: {}
 """).assert_success()
 
 
-@pytest.mark.skip(reason='fix')
-def test_interface_type_inputs_type_override_bad(parser):
-    parser.parse_literal("""
-tosca_definitions_version: tosca_simple_yaml_1_0
-data_types:
-  MyType1: {}
-  MyType2:
-    derived_from: MyType1
-interface_types:
-  MyType1:
-    inputs:
-      my_input:
-        type: MyType2
-  MyType2:
-    derived_from: MyType1
-    inputs:
-      my_input:
-        type: MyType1
-""").assert_failure()
+# Operation description
 
-
-# Operations
-
-def test_interface_type_operation_empty(parser):
+@pytest.mark.parametrize('value', data.NOT_A_STRING)
+def test_interface_type_operation_description_wrong_yaml_type(parser, value):
     parser.parse_literal("""
 tosca_definitions_version: tosca_simple_yaml_1_0
 interface_types:
   MyType:
-    my_operation: {}
-""").assert_success()
+    my_operation:
+      description: {{ value }}
+""", dict(value=value)).assert_failure()
 
 
-def test_interface_type_operation_fields(parser):
+def test_interface_type_operation_description(parser):
     parser.parse_literal("""
 tosca_definitions_version: tosca_simple_yaml_1_0
 interface_types:
   MyType:
     my_operation:
       description: a description
-      implementation: {}
-      inputs: {}
 """).assert_success()
 
 
@@ -176,89 +105,6 @@ interface_types:
 """, dict(value=value)).assert_failure()
 
 
-# Operation inputs
-
-def test_interface_type_operation_inputs_add(parser):
-    parser.parse_literal("""
-tosca_definitions_version: tosca_simple_yaml_1_0
-interface_types:
-  MyType1:
-    my_operation:
-      inputs:
-        my_input:
-          type: string
-  MyType2:
-    derived_from: MyType1
-    my_operation:
-      inputs:
-        my_input:
-          type: string
-""").assert_success()
-
-
-def test_interface_type_operation_inputs_override_same_type(parser):
-    parser.parse_literal("""
-tosca_definitions_version: tosca_simple_yaml_1_0
-interface_types:
-  MyType1:
-    my_operation:
-      inputs:
-        my_input:
-          type: string
-  MyType2:
-    derived_from: MyType1
-    my_operation:
-      inputs:
-        my_input:
-          type: string
-""").assert_success()
-
-
-def test_interface_type_operation_inputs_override_derived_type(parser):
-    parser.parse_literal("""
-tosca_definitions_version: tosca_simple_yaml_1_0
-data_types:
-  MyType1: {}
-  MyType2:
-    derived_from: MyType1
-interface_types:
-  MyType1:
-    my_operation:
-      inputs:
-        my_input:
-          type: MyType1
-  MyType2:
-    derived_from: MyType1
-    my_operation:
-      inputs:
-        my_input:
-          type: MyType2
-""").assert_success()
-
-
-@pytest.mark.skip(reason='fix')
-def test_interface_type_operation_inputs_override_bad(parser):
-    parser.parse_literal("""
-tosca_definitions_version: tosca_simple_yaml_1_0
-data_types:
-  MyType1: {}
-  MyType2:
-    derived_from: MyType1
-interface_types:
-  MyType1:
-    my_operation:
-      inputs:
-        my_input:
-          type: MyType2
-  MyType2:
-    derived_from: MyType1
-    my_operation:
-      inputs:
-        my_input:
-          type: MyType1
-""").assert_failure()
-
-
 # Unicode
 
 def test_interface_type_unicode(parser):



Mime
View raw message