def test_to_from_dict(self) -> None: self.maxDiff = None item_dict = self.get_example_item_dict() param_dict = deepcopy(item_dict) assert_to_from_dict(self, Item, param_dict) item = Item.from_dict(param_dict) self.assertEqual(item.id, "CS3-20160503_132131_05") # test asset creation additional field(s) self.assertEqual( item.assets["analytic"].extra_fields["product"], "http://cool-sat.com/catalog/products/analytic.json", ) self.assertEqual(len(item.assets["thumbnail"].extra_fields), 0) # test that the parameter is preserved self.assertEqual(param_dict, item_dict) # assert that the parameter is not preserved with # non-default parameter _ = Item.from_dict(param_dict, preserve_dict=False) self.assertNotEqual(param_dict, item_dict)
def test_to_from_dict(self) -> None: with open(self.example_uri) as f: d = json.load(f) assert_to_from_dict(self, pystac.Item, d)
def test_to_from_dict(self) -> None: with open(self.label_example_1_uri, encoding="utf-8") as f: label_example_1_dict = json.load(f) assert_to_from_dict(self, Item, label_example_1_dict)
def test_to_from_dict(self) -> None: with open(self.FILE_ITEM_EXAMPLE_URI) as f: item_dict = json.load(f) assert_to_from_dict(self, pystac.Item, item_dict)
def test_to_from_dict(self) -> None: with open(self.PLANET_EXAMPLE_URI) as f: item_dict = json.load(f) assert_to_from_dict(self, Item, item_dict)
def test_to_from_dict(self) -> None: assert_to_from_dict(self, pystac.Item, self.item_dict)