From 0ca2bc087a0a7440cf7f5e1666e07769809d3f9d Mon Sep 17 00:00:00 2001 From: Chris Lenk Date: Wed, 6 Feb 2019 14:27:33 -0500 Subject: [PATCH 1/2] Fix SDO link in docs --- docs/guide/creating.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/guide/creating.ipynb b/docs/guide/creating.ipynb index 058aae3..83efb56 100644 --- a/docs/guide/creating.ipynb +++ b/docs/guide/creating.ipynb @@ -498,7 +498,7 @@ "source": [ "As with indicators, the ``type``, ``id``, ``created``, and ``modified`` properties will be set automatically if not provided. For Malware objects, the ``labels`` and ``name`` properties must be provided.\n", "\n", - "You can see the full list of SDO classes [here](../api/stix2.v20.sdo.rst)." + "You can see the full list of SDO classes [here](../api/v20/stix2.v20.sdo.rst)." ] }, { From 69d2529f0ecfca41ddcd1d42a1a1945cd97a5de3 Mon Sep 17 00:00:00 2001 From: Chris Lenk Date: Wed, 6 Feb 2019 15:23:00 -0500 Subject: [PATCH 2/2] Fix style issues --- stix2/markings/utils.py | 2 +- stix2/properties.py | 2 +- stix2/test/v20/test_observed_data.py | 24 ++++++++++++------------ stix2/test/v21/test_observed_data.py | 18 +++++++++--------- 4 files changed, 23 insertions(+), 23 deletions(-) diff --git a/stix2/markings/utils.py b/stix2/markings/utils.py index 4b4841c..d8bbf1d 100644 --- a/stix2/markings/utils.py +++ b/stix2/markings/utils.py @@ -39,7 +39,7 @@ def _validate_selector(obj, selector): def _get_marking_id(marking): - if type(marking).__name__ is 'MarkingDefinition': # avoid circular import + if type(marking).__name__ == 'MarkingDefinition': # avoid circular import return marking.id return marking diff --git a/stix2/properties.py b/stix2/properties.py index d6cc624..5de7a1e 100644 --- a/stix2/properties.py +++ b/stix2/properties.py @@ -143,7 +143,7 @@ class ListProperty(Property): if type(self.contained) is EmbeddedObjectProperty: obj_type = self.contained.type - elif type(self.contained).__name__ is "STIXObjectProperty": + elif type(self.contained).__name__ == "STIXObjectProperty": # ^ this way of checking doesn't require a circular import # valid is already an instance of a python-stix2 class; no need # to turn it into a dictionary and then pass it to the class diff --git a/stix2/test/v20/test_observed_data.py b/stix2/test/v20/test_observed_data.py index 1c3cad4..84cdf72 100644 --- a/stix2/test/v20/test_observed_data.py +++ b/stix2/test/v20/test_observed_data.py @@ -1095,11 +1095,11 @@ def test_process_example_empty_error(): def test_process_example_empty_with_extensions(): with pytest.raises(stix2.exceptions.AtLeastOnePropertyError) as excinfo: - stix2.v20.Process( - extensions={ - "windows-process-ext": {}, - }, - ) + stix2.v20.Process( + extensions={ + "windows-process-ext": {}, + }, + ) assert excinfo.value.cls == stix2.v20.WindowsProcessExt properties_of_extension = list(stix2.v20.WindowsProcessExt._properties.keys()) @@ -1127,13 +1127,13 @@ def test_process_example_windows_process_ext(): def test_process_example_windows_process_ext_empty(): with pytest.raises(stix2.exceptions.AtLeastOnePropertyError) as excinfo: - stix2.v20.Process( - pid=1221, - name="gedit-bin", - extensions={ - "windows-process-ext": {}, - }, - ) + stix2.v20.Process( + pid=1221, + name="gedit-bin", + extensions={ + "windows-process-ext": {}, + }, + ) assert excinfo.value.cls == stix2.v20.WindowsProcessExt properties_of_extension = list(stix2.v20.WindowsProcessExt._properties.keys()) diff --git a/stix2/test/v21/test_observed_data.py b/stix2/test/v21/test_observed_data.py index f3e1ea0..5d0f9b1 100644 --- a/stix2/test/v21/test_observed_data.py +++ b/stix2/test/v21/test_observed_data.py @@ -1073,9 +1073,9 @@ def test_process_example_empty_error(): def test_process_example_empty_with_extensions(): with pytest.raises(stix2.exceptions.AtLeastOnePropertyError) as excinfo: - stix2.v21.Process(extensions={ - "windows-process-ext": {}, - }) + stix2.v21.Process(extensions={ + "windows-process-ext": {}, + }) assert excinfo.value.cls == stix2.v21.WindowsProcessExt properties_of_extension = list(stix2.v21.WindowsProcessExt._properties.keys()) @@ -1102,12 +1102,12 @@ def test_process_example_windows_process_ext(): def test_process_example_windows_process_ext_empty(): with pytest.raises(stix2.exceptions.AtLeastOnePropertyError) as excinfo: - stix2.v21.Process( - pid=1221, - extensions={ - "windows-process-ext": {}, - }, - ) + stix2.v21.Process( + pid=1221, + extensions={ + "windows-process-ext": {}, + }, + ) assert excinfo.value.cls == stix2.v21.WindowsProcessExt properties_of_extension = list(stix2.v21.WindowsProcessExt._properties.keys())