-
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add include tag capability for input files (#29)
- Loading branch information
Showing
9 changed files
with
263 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import os | ||
|
||
import xmltodict | ||
|
||
from microstructpy import cli | ||
|
||
|
||
def test_equivalence(): | ||
print(os.getcwd()) | ||
files_dir = os.path.join(os.path.dirname(__file__), 'test_includes_files') | ||
with open(os.path.join(files_dir, 'expected_input.xml'), 'r') as file: | ||
expected = xmltodict.parse(file.read()) | ||
|
||
for fname in ['input.xml', 'different_dir/input.xml']: | ||
actual = cli.input2dict(os.path.join(files_dir, fname)) | ||
assert expected == actual |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<input> | ||
<include> ../materials.xml </include> | ||
<domain> | ||
<shape> square </shape> | ||
<side_length> 20 </side_length> | ||
</domain> | ||
<settings> | ||
<verbose> True </verbose> | ||
</settings> | ||
</input> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<input> | ||
<material> | ||
<name> Fine 1 </name> | ||
<shape> circle </shape> | ||
<size> 0.1 </size> | ||
</material> | ||
|
||
<material> | ||
<name> Fine 2 </name> | ||
<shape> circle </shape> | ||
<size> 0.1 </size> | ||
</material> | ||
|
||
<material> | ||
<name> Coarse </name> | ||
<shape> circle </shape> | ||
<size> 0.3 </size> | ||
</material> | ||
<domain> | ||
<shape> square </shape> | ||
<side_length> 20 </side_length> | ||
</domain> | ||
<settings> | ||
<verbose> True </verbose> | ||
</settings> | ||
</input> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<material> | ||
<shape> circle </shape> | ||
<size> 0.1 </size> | ||
</material> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<input> | ||
<include> materials.xml </include> | ||
<domain> | ||
<shape> square </shape> | ||
<side_length> 20 </side_length> | ||
</domain> | ||
<settings> | ||
<verbose> True </verbose> | ||
</settings> | ||
</input> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<input> | ||
<material> | ||
<name> Fine 1 </name> | ||
<include> fine_grained.xml </include> | ||
</material> | ||
|
||
<material> | ||
<name> Fine 2 </name> | ||
<include> fine_grained.xml </include> | ||
</material> | ||
|
||
<material> | ||
<name> Coarse </name> | ||
<shape> circle </shape> | ||
<size> 0.3 </size> | ||
</material> | ||
</input> |