-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4c0c353
commit de5de22
Showing
3 changed files
with
40 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
1.23 2.34 3.45 | ||
4.57 5.68 6.79 # Some comment |
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,23 @@ | ||
from tests.utils import test_output_dir, test_reference_dir, assert_files_equal | ||
from hydrolib.core.io.dflowfm.xyz.models import XYZPoint | ||
from hydrolib.core.io.dflowfm.xyz.serializer import XYZSerializer | ||
from hydrolib.core.basemodel import SerializerConfig | ||
|
||
class TestXYZSerializer: | ||
def test_serialize(self): | ||
output_file = test_output_dir / "test.xyz" | ||
reference_file = test_reference_dir / "xyz" / "test.xyz" | ||
|
||
data = { | ||
"points" : [ | ||
XYZPoint(x=1.232, y=2.343, z= 3.454), | ||
XYZPoint(x=4.565, y=5.676, z= 6.787, comment="Some comment")] | ||
} | ||
|
||
config = SerializerConfig(float_format=".2f") | ||
|
||
XYZSerializer.serialize(output_file, data, config) | ||
|
||
assert_files_equal(output_file, reference_file) | ||
|
||
|