Skip to content

Commit fb566fc

Browse files
committed
add missing import to view
1 parent 31eef48 commit fb566fc

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

pystac/extensions/view.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from pystac import Extensions
22
from pystac.item import Item
33
from pystac.extensions.base import (ItemExtension, ExtensionDefinition, ExtendedObject)
4+
from typing import Optional
45

56

67
class ViewItemExt(ItemExtension):

tests/extensions/test_view.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,29 @@ def test_apply(self):
2929
sun_azimuth=2.0,
3030
sun_elevation=1.0)
3131

32+
def test_apply_one(self):
33+
item = next(TestCases.test_case_2().get_all_items())
34+
with self.assertRaises(ExtensionError):
35+
item.ext.view
36+
37+
item.ext.enable(Extensions.VIEW)
38+
item.ext.view.apply(off_nadir=1.0)
39+
40+
@unittest.expectedFailure
41+
def test_apply_none(self):
42+
item = next(TestCases.test_case_2().get_all_items())
43+
with self.assertRaises(ExtensionError):
44+
item.ext.view
45+
46+
item.ext.enable(Extensions.VIEW)
47+
item.ext.view.apply(
48+
off_nadir=None,
49+
incidence_angle=None,
50+
azimuth=None,
51+
sun_azimuth=None,
52+
sun_elevation=None,
53+
)
54+
3255
def test_validate_view(self):
3356
item = pystac.read_file(self.example_uri)
3457
item.validate()

0 commit comments

Comments
 (0)