Skip to content

Commit 1c3d520

Browse files
committed
2 parents 263d579 + b5ffcc1 commit 1c3d520

File tree

2 files changed

+48
-1
lines changed

2 files changed

+48
-1
lines changed

stix2/base.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,9 @@ def _check_properties_dependency(self, list_of_properties, list_of_dependent_pro
104104
failed_dependency_pairs = []
105105
for p in list_of_properties:
106106
for dp in list_of_dependent_properties:
107-
if not self.get(p) and self.get(dp):
107+
if p not in self and dp in self:
108+
failed_dependency_pairs.append((p, dp))
109+
elif p in self and (self[p] is None or self[p] is False) and dp in self and self[dp] is not None:
108110
failed_dependency_pairs.append((p, dp))
109111
if failed_dependency_pairs:
110112
raise DependentPropertiesError(self.__class__, failed_dependency_pairs)

stix2/test/v21/test_location.py

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,3 +377,48 @@ def test_bing_map_url_multiple_props_and_long_lat_provided():
377377

378378
loc_url = loc.to_maps_url("Bing Maps")
379379
assert loc_url == expected_url
380+
381+
382+
def test_bing_map_url_for_0_long_lat():
383+
expected_url = "https://bing.com/maps/default.aspx?where1=0.0%2C0.0&lvl=16"
384+
385+
loc = stix2.v21.Location(
386+
region="Gulf of Guinea",
387+
country="International waters",
388+
street_address="0°N, 0°E – Null Island",
389+
latitude=0.0,
390+
longitude=0.0,
391+
)
392+
393+
loc_url = loc.to_maps_url("Bing Maps")
394+
assert loc_url == expected_url
395+
396+
397+
def test_bing_map_url_for_0_long():
398+
expected_url = "https://bing.com/maps/default.aspx?where1=0.0%2C39.668&lvl=16"
399+
400+
loc = stix2.v21.Location(
401+
region="Eastern Africa",
402+
country="Kenya",
403+
street_address="0°N, 39.668°E",
404+
latitude=0.0,
405+
longitude=39.668,
406+
)
407+
408+
loc_url = loc.to_maps_url("Bing Maps")
409+
assert loc_url == expected_url
410+
411+
412+
def test_bing_map_url_for_0_lat():
413+
expected_url = "https://bing.com/maps/default.aspx?where1=51.477%2C0.0&lvl=16"
414+
415+
loc = stix2.v21.Location(
416+
region="Western Europe",
417+
country="United Kingdom",
418+
street_address="Royal Observatory, Blackheath Ave, Greenwich, London SE10 8XJ, United Kingdom",
419+
latitude=51.477,
420+
longitude=0.0,
421+
)
422+
423+
loc_url = loc.to_maps_url("Bing Maps")
424+
assert loc_url == expected_url

0 commit comments

Comments
 (0)