Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
W
WindEnergyToolbox
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository 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
toolbox
WindEnergyToolbox
Commits
e5d2f728
Commit
e5d2f728
authored
7 months ago
by
Riccardo Riva
Committed by
Mads M. Pedersen
7 months ago
Browse files
Options
Downloads
Patches
Plain Diff
Fix
#126
parent
91f6a4b1
No related branches found
No related tags found
1 merge request
!272
Fix #126
Pipeline
#61124
passed
7 months ago
Stage: build
Stage: test
Stage: deploy
Changes
2
Pipelines
3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
wetb/hawc2/htc_file.py
+17
-0
17 additions, 0 deletions
wetb/hawc2/htc_file.py
wetb/hawc2/tests/test_htc_file.py
+9
-0
9 additions, 0 deletions
wetb/hawc2/tests/test_htc_file.py
with
26 additions
and
0 deletions
wetb/hawc2/htc_file.py
+
17
−
0
View file @
e5d2f728
...
...
@@ -218,6 +218,23 @@ class HTCFile(HTCContents, HTCDefaults, HTCExtensions):
with
self
.
open
(
filename
,
'
w
'
,
encoding
=
'
cp1252
'
)
as
fid
:
fid
.
write
(
str
(
self
))
def
copy
(
self
):
"""
Copy this htc file.
Returns
-------
new_htc : HTCFile
Copy of this htc file.
"""
new_htc
=
HTCFile
()
for
key
in
self
.
keys
():
new_htc
[
key
]
=
self
[
key
].
copy
()
new_htc
.
modelpath
=
self
.
modelpath
new_htc
.
filename
=
self
.
filename
[:
-
4
]
+
"
_copy.htc
"
return
new_htc
def
set_name
(
self
,
name
,
subfolder
=
''
):
"""
Sets the base filename of the simulation files.
...
...
This diff is collapsed.
Click to expand it.
wetb/hawc2/tests/test_htc_file.py
+
9
−
0
View file @
e5d2f728
...
...
@@ -395,6 +395,15 @@ end turb_export;"""
assert
tower2
.
timoschenko_input
.
set
.
values
==
[
1
,
2
]
assert
tower2
.
timoschenko_input__2
.
set
.
values
==
[
3
,
3
]
def
test_htc_copy2
(
self
):
htc1
=
HTCFile
(
self
.
testfilepath
+
"
test.htc
"
)
htc2
=
htc1
.
copy
()
test1
=
len
(
htc2
.
compare
(
htc1
))
==
0
test2
=
id
(
htc1
)
!=
id
(
htc2
)
assert
test1
and
test2
assert
htc1
.
modelpath
==
htc2
.
modelpath
assert
htc2
.
filename
==
self
.
testfilepath
+
"
test_copy.htc
"
def
test_location
(
self
):
htc
=
HTCFile
(
self
.
testfilepath
+
"
test.htc
"
)
assert
htc
.
new_htc_structure
.
main_body__3
.
location
()
==
'
test.htc/new_htc_structure/main_body__3
'
...
...
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