File tree Expand file tree Collapse file tree 2 files changed +13
-0
lines changed
Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -170,6 +170,18 @@ def test_granular_example_with_bad_selector():
170170 assert str (excinfo .value ) == "Invalid value for GranularMarking 'selectors': must adhere to selector syntax."
171171
172172
173+ def test_granular_marking_mutual_exclusion_error ():
174+ with pytest .raises (stix2 .exceptions .MutuallyExclusivePropertiesError ) as excinfo :
175+ stix2 .v21 .GranularMarking (
176+ lang = "en" ,
177+ marking_ref = stix2 .TLP_GREEN ,
178+ selectors = ["foo" ],
179+ )
180+ assert excinfo .value .cls == stix2 .v21 .GranularMarking
181+ assert excinfo .value .properties == ["lang" , "marking_ref" ]
182+ assert 'are mutually exclusive' in str (excinfo .value )
183+
184+
173185def test_campaign_with_granular_markings_example ():
174186 campaign = stix2 .v21 .Campaign (
175187 id = "campaign--8e2e2d2b-17d4-4cbf-938f-98ee46b3cd3f" ,
Original file line number Diff line number Diff line change @@ -77,6 +77,7 @@ class GranularMarking(_STIXBase21):
7777 def _check_object_constraints (self ):
7878 super (GranularMarking , self )._check_object_constraints ()
7979 self ._check_at_least_one_property (['lang' , 'marking_ref' ])
80+ self ._check_mutually_exclusive_properties (['lang' , 'marking_ref' ])
8081
8182
8283class LanguageContent (_STIXBase21 ):
You can’t perform that action at this time.
0 commit comments