Skip to content

Commit 5f0e052

Browse files
author
Jon Duckworth
authored
Merge pull request #395 from namannimmo10/patch-1
Handle `tests.utils.test_to_from_dict` conflict with other test runners
2 parents a8bcb45 + 23f56c9 commit 5f0e052

File tree

10 files changed

+19
-19
lines changed

10 files changed

+19
-19
lines changed

tests/extensions/test_eo.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from pystac.summaries import RangeSummary
77
from pystac.utils import get_opt
88
from pystac.extensions.eo import EOExtension, Band
9-
from tests.utils import TestCases, test_to_from_dict
9+
from tests.utils import TestCases, assert_to_from_dict
1010

1111

1212
class BandsTest(unittest.TestCase):
@@ -49,7 +49,7 @@ def setUp(self) -> None:
4949
def test_to_from_dict(self) -> None:
5050
with open(self.LANDSAT_EXAMPLE_URI) as f:
5151
item_dict = json.load(f)
52-
test_to_from_dict(self, Item, item_dict)
52+
assert_to_from_dict(self, Item, item_dict)
5353

5454
def test_validate_eo(self) -> None:
5555
item = pystac.read_file(self.LANDSAT_EXAMPLE_URI)

tests/extensions/test_file.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import unittest
33

44
import pystac
5-
from tests.utils import TestCases, test_to_from_dict
5+
from tests.utils import TestCases, assert_to_from_dict
66
from pystac.extensions.file import FileExtension, FileDataType
77

88

@@ -15,7 +15,7 @@ def setUp(self) -> None:
1515
def test_to_from_dict(self) -> None:
1616
with open(self.FILE_EXAMPLE_URI) as f:
1717
item_dict = json.load(f)
18-
test_to_from_dict(self, pystac.Item, item_dict)
18+
assert_to_from_dict(self, pystac.Item, item_dict)
1919

2020
def test_validate_file(self) -> None:
2121
item = pystac.Item.from_file(self.FILE_EXAMPLE_URI)

tests/extensions/test_label.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
)
1717
import pystac.validation
1818
from pystac.utils import get_opt
19-
from tests.utils import TestCases, test_to_from_dict
19+
from tests.utils import TestCases, assert_to_from_dict
2020

2121

2222
class LabelTest(unittest.TestCase):
@@ -36,7 +36,7 @@ def test_to_from_dict(self) -> None:
3636
with open(self.label_example_1_uri) as f:
3737
label_example_1_dict = json.load(f)
3838

39-
test_to_from_dict(self, Item, label_example_1_dict)
39+
assert_to_from_dict(self, Item, label_example_1_dict)
4040

4141
def test_from_file(self) -> None:
4242
label_example_1 = Item.from_file(self.label_example_1_uri)

tests/extensions/test_pointcloud.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
PointcloudSchema,
1414
PointcloudStatistic,
1515
)
16-
from tests.utils import TestCases, test_to_from_dict
16+
from tests.utils import TestCases, assert_to_from_dict
1717

1818

1919
class PointcloudTest(unittest.TestCase):
@@ -27,7 +27,7 @@ def setUp(self) -> None:
2727
def test_to_from_dict(self) -> None:
2828
with open(self.example_uri) as f:
2929
d = json.load(f)
30-
test_to_from_dict(self, pystac.Item, d)
30+
assert_to_from_dict(self, pystac.Item, d)
3131

3232
def test_apply(self) -> None:
3333
item = next(iter(TestCases.test_case_2().get_all_items()))

tests/extensions/test_projection.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import pystac
77
from pystac.extensions.projection import ProjectionExtension
88
from pystac.utils import get_opt
9-
from tests.utils import TestCases, test_to_from_dict
9+
from tests.utils import TestCases, assert_to_from_dict
1010

1111
WKT2 = """
1212
GEOGCS["WGS 84",
@@ -80,7 +80,7 @@ def setUp(self) -> None:
8080
def test_to_from_dict(self) -> None:
8181
with open(self.example_uri) as f:
8282
d = json.load(f)
83-
test_to_from_dict(self, pystac.Item, d)
83+
assert_to_from_dict(self, pystac.Item, d)
8484

8585
def test_apply(self) -> None:
8686
item = next(iter(TestCases.test_case_2().get_all_items()))

tests/extensions/test_raster.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
DataType,
1313
Statistics,
1414
)
15-
from tests.utils import TestCases, test_to_from_dict
15+
from tests.utils import TestCases, assert_to_from_dict
1616

1717

1818
class RasterTest(unittest.TestCase):
@@ -30,7 +30,7 @@ def setUp(self) -> None:
3030
def test_to_from_dict(self) -> None:
3131
with open(self.PLANET_EXAMPLE_URI) as f:
3232
item_dict = json.load(f)
33-
test_to_from_dict(self, Item, item_dict)
33+
assert_to_from_dict(self, Item, item_dict)
3434

3535
def test_validate_raster(self) -> None:
3636
item = pystac.read_file(self.PLANET_EXAMPLE_URI)

tests/extensions/test_timestamps.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import pystac
66
from pystac.extensions.timestamps import TimestampsExtension
77
from pystac.utils import get_opt, str_to_datetime, datetime_to_str
8-
from tests.utils import TestCases, test_to_from_dict
8+
from tests.utils import TestCases, assert_to_from_dict
99

1010

1111
class TimestampsTest(unittest.TestCase):
@@ -20,7 +20,7 @@ def setUp(self) -> None:
2020
self.sample_datetime = str_to_datetime(self.sample_datetime_str)
2121

2222
def test_to_from_dict(self) -> None:
23-
test_to_from_dict(self, pystac.Item, self.item_dict)
23+
assert_to_from_dict(self, pystac.Item, self.item_dict)
2424

2525
def test_apply(self) -> None:
2626
item = next(iter(TestCases.test_case_2().get_all_items()))

tests/extensions/test_view.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import pystac
66
from pystac.summaries import RangeSummary
77
from pystac.extensions.view import ViewExtension
8-
from tests.utils import TestCases, test_to_from_dict
8+
from tests.utils import TestCases, assert_to_from_dict
99

1010

1111
class ViewTest(unittest.TestCase):
@@ -16,7 +16,7 @@ def setUp(self) -> None:
1616
def test_to_from_dict(self) -> None:
1717
with open(self.example_uri) as f:
1818
d = json.load(f)
19-
test_to_from_dict(self, pystac.Item, d)
19+
assert_to_from_dict(self, pystac.Item, d)
2020

2121
def test_apply(self) -> None:
2222
item = next(iter(TestCases.test_case_2().get_all_items()))

tests/test_item.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import pystac.serialization.common_properties
1212
from pystac.item import CommonMetadata
1313
from pystac.utils import datetime_to_str, get_opt, str_to_datetime, is_absolute_href
14-
from tests.utils import TestCases, test_to_from_dict
14+
from tests.utils import TestCases, assert_to_from_dict
1515

1616

1717
class ItemTest(unittest.TestCase):
@@ -26,7 +26,7 @@ def test_to_from_dict(self) -> None:
2626

2727
item_dict = self.get_example_item_dict()
2828

29-
test_to_from_dict(self, Item, item_dict)
29+
assert_to_from_dict(self, Item, item_dict)
3030
item = Item.from_dict(item_dict)
3131
self.assertEqual(item.id, "CS3-20160503_132131_05")
3232

tests/utils/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
from tests.utils.stac_io_mock import MockStacIO # type:ignore
1818

1919

20-
def test_to_from_dict(
20+
def assert_to_from_dict(
2121
test_class: unittest.TestCase,
2222
stac_object_class: Type[pystac.STACObject],
2323
d: Dict[str, Any],

0 commit comments

Comments
 (0)