Skip to content

Commit

Permalink
add missing import to view
Browse files Browse the repository at this point in the history
  • Loading branch information
tyler-c2s committed Feb 9, 2021
1 parent 31eef48 commit fb566fc
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
1 change: 1 addition & 0 deletions pystac/extensions/view.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from pystac import Extensions
from pystac.item import Item
from pystac.extensions.base import (ItemExtension, ExtensionDefinition, ExtendedObject)
from typing import Optional


class ViewItemExt(ItemExtension):
Expand Down
23 changes: 23 additions & 0 deletions tests/extensions/test_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,29 @@ def test_apply(self):
sun_azimuth=2.0,
sun_elevation=1.0)

def test_apply_one(self):
item = next(TestCases.test_case_2().get_all_items())
with self.assertRaises(ExtensionError):
item.ext.view

item.ext.enable(Extensions.VIEW)
item.ext.view.apply(off_nadir=1.0)

@unittest.expectedFailure
def test_apply_none(self):
item = next(TestCases.test_case_2().get_all_items())
with self.assertRaises(ExtensionError):
item.ext.view

item.ext.enable(Extensions.VIEW)
item.ext.view.apply(
off_nadir=None,
incidence_angle=None,
azimuth=None,
sun_azimuth=None,
sun_elevation=None,
)

def test_validate_view(self):
item = pystac.read_file(self.example_uri)
item.validate()
Expand Down

0 comments on commit fb566fc

Please sign in to comment.