Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
CaosDB Crawler
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
caosdb
Software
CaosDB Crawler
Commits
a532cb43
Commit
a532cb43
authored
2 years ago
by
florian
Browse files
Options
Downloads
Patches
Plain Diff
TST: Add failing unit test for multiple macro usage
parent
db761bcb
No related branches found
No related tags found
1 merge request
!53
Release 0.1
Pipeline
#29163
passed with warnings
2 years ago
Stage: info
Stage: setup
Stage: cert
Stage: style
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
unittests/test_macros.py
+36
-0
36 additions, 0 deletions
unittests/test_macros.py
with
36 additions
and
0 deletions
unittests/test_macros.py
+
36
−
0
View file @
a532cb43
...
...
@@ -293,3 +293,39 @@ extroot3: !macro
assert
cfood
[
"
extroot2
"
][
"
test_two
"
]
is
None
# No recursion
assert
cfood
[
"
extroot3
"
][
"
test_four
"
]
is
None
@pytest.mark.xfail
(
reason
=
"
Fix multiple usage of the same macro.
"
)
def
test_use_macro_twice
():
"""
Test that the same macro can be used twice with different parameters in
the same CFood element if the name depends on the parameters.
"""
cfood
=
_temp_file_load
(
"""
---
metadata:
macros:
- !defmacro
name: test_twice
params:
macro_name: default_name
a: 4
definition:
$macro_name:
something:
a: $a
---
extroot: !macro
test_twice:
macro_name: once
test_twice:
macro_name: twice
a: 5
test_twice:
"""
)
for
name
in
[
"
once
"
,
"
twice
"
,
"
default_name
"
]:
assert
name
in
cfood
[
"
extroot
"
]
assert
cfood
[
"
extroot
"
][
"
once
"
][
"
something
"
][
"
a
"
]
==
4
assert
cfood
[
"
extroot
"
][
"
twice
"
][
"
something
"
][
"
a
"
]
==
5
assert
cfood
[
"
extroot
"
][
"
default_name
"
][
"
something
"
][
"
a
"
]
==
4
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment