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
428de240
Commit
428de240
authored
2 years ago
by
florian
Browse files
Options
Downloads
Patches
Plain Diff
TST: Add test for multiple circular macro definitions
parent
f9ac6218
Branches
Branches containing commit
Tags
Tags containing commit
2 merge requests
!53
Release 0.1
,
!25
F macros
Pipeline
#28934
failed
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
+35
-0
35 additions, 0 deletions
unittests/test_macros.py
with
35 additions
and
0 deletions
unittests/test_macros.py
+
35
−
0
View file @
428de240
...
...
@@ -249,3 +249,38 @@ testnode:
assert
dat
[
"
testnode
"
][
"
obl
"
][
"
replaced1
"
][
"
c
"
][
"
t2
"
]
==
"
25
"
assert
dat
[
"
testnode
"
][
"
obl
"
][
"
replaced1
"
][
"
d
"
][
0
]
==
"
a
"
assert
dat
[
"
testnode
"
][
"
obl
"
][
"
replaced1
"
][
"
d
"
][
1
]
==
"
25
"
def
test_circular_macro_definition
(
register_macros
,
macro_store_reset
):
"""
Test the (ab-)use of macros to create an infinite loop.
"""
cfood
=
_temp_file_load
(
"""
---
metadata:
macros:
- !defmacro
name: test_one
params: {}
definition: !macro
test_two:
- !defmacro
name: test_two
params: {}
definition: !macro
test_one:
- !defmacro
name: test_three
params: {}
definition: !macro
test_two:
---
extroot: !macro
test_one:
extroot2: !macro
test_three:
"""
)
# macros in macros can be used, but there are no circles; they stop at the first one.
assert
"
test_one
"
not
in
cfood
[
"
extroot
"
]
assert
cfood
[
"
extroot
"
][
"
test_two
"
]
is
None
assert
"
test_three
"
not
in
cfood
[
"
extroot2
"
]
assert
"
test_one
"
not
in
cfood
[
"
extroot2
"
]
assert
cfood
[
"
extroot2
"
][
"
test_two
"
]
is
None
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