@@ -32,59 +32,51 @@ def pc_item(example_uri) -> pystac.Item:
3232 return pystac .Item .from_file (example_uri )
3333
3434
35- class PointcloudTest (unittest .TestCase ):
36- def setUp (self ) -> None :
37- self .example_uri = TestCases .get_path ("data-files/pointcloud/example-laz.json" )
38- self .example_uri_no_statistics = TestCases .get_path (
39- "data-files/pointcloud/example-laz-no-statistics.json"
40- )
41-
42- def test_to_from_dict (self ) -> None :
43- with open (self .example_uri ) as f :
44- d = json .load (f )
45- assert_to_from_dict (pystac .Item , d )
46-
47- def test_apply (self ) -> None :
48- item = next (TestCases .case_2 ().get_items (recursive = True ))
49-
50- assert not PointcloudExtension .has_extension (item )
51-
52- PointcloudExtension .add_to (item )
53- PointcloudExtension .ext (item ).apply (
54- 1000 ,
55- PhenomenologyType .LIDAR ,
56- "laszip" ,
57- [Schema ({"name" : "X" , "size" : 8 , "type" : "floating" })],
58- )
59- assert PointcloudExtension .has_extension (item )
60-
61- @pytest .mark .vcr ()
62- def test_validate_pointcloud (self ) -> None :
63- item = pystac .Item .from_file (self .example_uri )
64- item .validate ()
65-
66- @pytest .mark .vcr ()
67- def test_count (self ) -> None :
68- pc_item = pystac .Item .from_file (self .example_uri )
69-
70- # Get
71- assert "pc:count" in pc_item .properties
72- pc_count = PointcloudExtension .ext (pc_item ).count
73- assert pc_count == pc_item .properties ["pc:count" ]
74-
75- # Set
76- PointcloudExtension .ext (pc_item ).count = pc_count + 100
77- assert pc_count + 100 == pc_item .properties ["pc:count" ]
78-
79- # Validate
35+ def test_to_from_dict (example_uri : str ) -> None :
36+ with open (example_uri ) as f :
37+ d = json .load (f )
38+ assert_to_from_dict (pystac .Item , d )
39+
40+ def test_apply () -> None :
41+ item = next (TestCases .case_2 ().get_items (recursive = True ))
42+
43+ assert not PointcloudExtension .has_extension (item )
44+
45+ PointcloudExtension .add_to (item )
46+ PointcloudExtension .ext (item ).apply (
47+ 1000 ,
48+ PhenomenologyType .LIDAR ,
49+ "laszip" ,
50+ [Schema ({"name" : "X" , "size" : 8 , "type" : "floating" })],
51+ )
52+ assert PointcloudExtension .has_extension (item )
53+
54+ @pytest .mark .vcr ()
55+ def test_validate_pointcloud (pc_item : pystac .Item ) -> None :
56+ pc_item .validate ()
57+
58+ @pytest .mark .vcr ()
59+ def test_count (pc_item : pystac .Item ) -> None :
60+ # Get
61+ assert "pc:count" in pc_item .properties
62+ pc_count = PointcloudExtension .ext (pc_item ).count
63+ assert pc_count == pc_item .properties ["pc:count" ]
64+
65+ # Set
66+ PointcloudExtension .ext (pc_item ).count = pc_count + 100
67+ assert pc_count + 100 == pc_item .properties ["pc:count" ]
68+
69+ # Validate
70+ pc_item .validate ()
71+
72+ # Cannot test validation errors until the pointcloud schema.json syntax is fixed
73+ # Ensure setting bad count fails validation
74+
75+ with pytest .raises (pystac .STACValidationError ):
76+ PointcloudExtension .ext (pc_item ).count = "not_an_int" # type:ignore
8077 pc_item .validate ()
8178
82- # Cannot test validation errors until the pointcloud schema.json syntax is fixed
83- # Ensure setting bad count fails validation
84-
85- with pytest .raises (pystac .STACValidationError ):
86- PointcloudExtension .ext (pc_item ).count = "not_an_int" # type:ignore
87- pc_item .validate ()
79+ class PointcloudTest (unittest .TestCase ):
8880
8981 @pytest .mark .vcr ()
9082 def test_type (self ) -> None :
@@ -348,6 +340,13 @@ def test_asset_ext_add_to(self) -> None:
348340 assert PointcloudExtension .get_schema_uri () in item .stac_extensions
349341
350342
343+ def setUp (self ) -> None :
344+ self .example_uri = TestCases .get_path ("data-files/pointcloud/example-laz.json" )
345+ self .example_uri_no_statistics = TestCases .get_path (
346+ "data-files/pointcloud/example-laz-no-statistics.json"
347+ )
348+
349+
351350class PointcloudSummariesTest (unittest .TestCase ):
352351 def setUp (self ) -> None :
353352 self .collection = pystac .Collection .from_file (
0 commit comments