-
-
Notifications
You must be signed in to change notification settings - Fork 7
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
Showing
4 changed files
with
52 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,21 @@ | ||
import pytest | ||
import xml.etree.ElementTree as ET | ||
|
||
|
||
# Define a fixture to load the XML file | ||
@pytest.fixture | ||
def osmchange_xml_obj(): | ||
with open("tests/data/test_osmchange.xml", "r") as fh: | ||
return ET.parse(fh) | ||
|
||
|
||
|
||
# Path to the changeset XML file | ||
@pytest.fixture | ||
def osmchange_file_path(): | ||
return "tests/data/test_osmchange.xml" | ||
|
||
|
||
# Path to the augmented diff XML file | ||
@pytest.fixture | ||
def adiff_file_path(): | ||
return "tests/data/test_adiff.xml" |
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,31 @@ | ||
from osmdiff import Node, AugmentedDiff, Relation, Way | ||
from typing_extensions import assert_type | ||
|
||
|
||
class TestAugmentedDiff: | ||
"tests for AugmentedDiff class" | ||
|
||
def test_init_augmenteddiff(self): | ||
"Test AugmentedDiff init" | ||
augmenteddiff = AugmentedDiff() | ||
assert_type(augmenteddiff, AugmentedDiff) | ||
assert_type(augmenteddiff.create, list) | ||
assert_type(augmenteddiff.modify, list) | ||
assert_type(augmenteddiff.delete, list) | ||
assert len(augmenteddiff.create) == 0 | ||
assert len(augmenteddiff.modify) == 0 | ||
assert len(augmenteddiff.delete) == 0 | ||
|
||
def test_set_sequencenumber(self): | ||
"Sequence number is not defined by default but can be set manually" | ||
augmented_diff = AugmentedDiff() | ||
assert not augmented_diff.sequence_number | ||
augmented_diff.sequence_number = 12345 | ||
assert augmented_diff.sequence_number == 12345 | ||
augmented_diff.sequence_number = "12345" | ||
assert augmented_diff.sequence_number == 12345 | ||
|
||
def test_read_changeset_from_xml_file(self, adiff_file_path): | ||
"Test initializing from an XML object" | ||
# not implemented yet | ||
pass |