Skip to content

Commit 4870116

Browse files
committed
Test RangeSummary equality and repr
1 parent b54b72e commit 4870116

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

tests/test_summaries.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from typing import Any
33
import unittest
44

5-
from pystac.summaries import Summarizer, Summaries
5+
from pystac.summaries import RangeSummary, Summarizer, Summaries
66
from tests.utils import TestCases
77

88

@@ -58,3 +58,21 @@ def test_summary_not_empty(self) -> None:
5858
coll = TestCases.test_case_5()
5959
summaries = Summarizer().summarize(coll.get_all_items())
6060
self.assertFalse(summaries.is_empty())
61+
62+
63+
class RangeSummaryTest(unittest.TestCase):
64+
def setUp(self) -> None:
65+
self.maxDiff = None
66+
67+
def test_repr(self) -> None:
68+
rs = RangeSummary(5, 10)
69+
self.assertEqual("{'minimum': 5, 'maximum': 10}", rs.__repr__())
70+
71+
def test_equality(self) -> None:
72+
rs_1 = RangeSummary(5, 10)
73+
rs_2 = RangeSummary(5, 10)
74+
rs_3 = RangeSummary(5, 11)
75+
76+
self.assertEqual(rs_1, rs_2)
77+
self.assertNotEqual(rs_1, rs_3)
78+
self.assertNotEqual(rs_1, (5, 10))

0 commit comments

Comments
 (0)