rename test, update the rest of the docstrings for object_similarity() and object_equivalence()
parent
7d7c56c64b
commit
c9e66def60
|
@ -4,7 +4,7 @@ import itertools
|
||||||
import logging
|
import logging
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from ...datastore import DataSink, DataSource, DataStoreMixin, Filter
|
from ...datastore import DataSource, DataStoreMixin, Filter
|
||||||
from ...utils import STIXdatetime, parse_into_datetime
|
from ...utils import STIXdatetime, parse_into_datetime
|
||||||
from ..pattern import equivalent_patterns
|
from ..pattern import equivalent_patterns
|
||||||
|
|
||||||
|
@ -28,8 +28,8 @@ def object_equivalence(
|
||||||
threshold: A numerical value between 0 and 100 to determine the minimum
|
threshold: A numerical value between 0 and 100 to determine the minimum
|
||||||
score to result in successfully calling both objects equivalent. This
|
score to result in successfully calling both objects equivalent. This
|
||||||
value can be tuned.
|
value can be tuned.
|
||||||
ds1: A DataStore object instance representing your graph
|
ds1 (optional): A DataStore object instance from which to pull related objects
|
||||||
ds2: A DataStore object instance representing your graph
|
ds2 (optional): A DataStore object instance from which to pull related objects
|
||||||
ignore_spec_version: A boolean indicating whether to test object types
|
ignore_spec_version: A boolean indicating whether to test object types
|
||||||
that belong to different spec versions (STIX 2.0 and STIX 2.1 for example).
|
that belong to different spec versions (STIX 2.0 and STIX 2.1 for example).
|
||||||
If set to True this check will be skipped.
|
If set to True this check will be skipped.
|
||||||
|
@ -85,8 +85,8 @@ def object_similarity(
|
||||||
obj2: A stix2 object instance
|
obj2: A stix2 object instance
|
||||||
prop_scores: A dictionary that can hold individual property scores,
|
prop_scores: A dictionary that can hold individual property scores,
|
||||||
weights, contributing score, matching score and sum of weights.
|
weights, contributing score, matching score and sum of weights.
|
||||||
ds1: A DataStore object instance representing your graph
|
ds1 (optional): A DataStore object instance from which to pull related objects
|
||||||
ds2: A DataStore object instance representing your graph
|
ds2 (optional): A DataStore object instance from which to pull related objects
|
||||||
ignore_spec_version: A boolean indicating whether to test object types
|
ignore_spec_version: A boolean indicating whether to test object types
|
||||||
that belong to different spec versions (STIX 2.0 and STIX 2.1 for example).
|
that belong to different spec versions (STIX 2.0 and STIX 2.1 for example).
|
||||||
If set to True this check will be skipped.
|
If set to True this check will be skipped.
|
||||||
|
@ -500,8 +500,8 @@ def list_reference_check(refs1, refs2, ds1, ds2, **weights):
|
||||||
|
|
||||||
def _datastore_check(ds1, ds2):
|
def _datastore_check(ds1, ds2):
|
||||||
if (
|
if (
|
||||||
issubclass(ds1.__class__, (DataStoreMixin, DataSink, DataSource)) or
|
issubclass(ds1.__class__, (DataStoreMixin, DataSource)) or
|
||||||
issubclass(ds2.__class__, (DataStoreMixin, DataSink, DataSource))
|
issubclass(ds2.__class__, (DataStoreMixin, DataSource))
|
||||||
):
|
):
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
|
@ -855,7 +855,7 @@ def test_object_similarity_exact_match():
|
||||||
assert stix2.equivalence.object.exact_match(t1, t2) == 0.0
|
assert stix2.equivalence.object.exact_match(t1, t2) == 0.0
|
||||||
|
|
||||||
|
|
||||||
def test_non_existent_config_for_object():
|
def test_no_datastore_fallsback_list_based_check_for_refs_check():
|
||||||
r1 = stix2.v21.Report(id=REPORT_ID, **REPORT_KWARGS)
|
r1 = stix2.v21.Report(id=REPORT_ID, **REPORT_KWARGS)
|
||||||
r2 = stix2.v21.Report(id=REPORT_ID, **REPORT_KWARGS)
|
r2 = stix2.v21.Report(id=REPORT_ID, **REPORT_KWARGS)
|
||||||
prop_scores = {}
|
prop_scores = {}
|
||||||
|
|
Loading…
Reference in New Issue