pre-commit changes

master
Emmanuelle Vargas-Gonzalez 2018-11-29 11:06:27 -05:00
parent e365de3693
commit 1b0fa0129f
5 changed files with 35 additions and 39 deletions

View File

@ -32,40 +32,32 @@ from .confidence import scales
from .core import _collect_stix2_mappings, parse, parse_observable
from .datastore import CompositeDataSource
from .datastore.filesystem import (
FileSystemSink, FileSystemSource,
FileSystemStore
FileSystemSink, FileSystemSource, FileSystemStore,
)
from .datastore.filters import Filter
from .datastore.memory import MemorySink, MemorySource, MemoryStore
from .datastore.taxii import (
TAXIICollectionSink, TAXIICollectionSource,
TAXIICollectionStore
TAXIICollectionSink, TAXIICollectionSource, TAXIICollectionStore,
)
from .environment import Environment, ObjectFactory
from .markings import (
add_markings, clear_markings, get_markings, is_marked,
remove_markings, set_markings
add_markings, clear_markings, get_markings, is_marked, remove_markings,
set_markings,
)
from .patterns import (
AndBooleanExpression, AndObservationExpression,
BasicObjectPathComponent, BinaryConstant,
BooleanConstant, EqualityComparisonExpression,
AndBooleanExpression, AndObservationExpression, BasicObjectPathComponent,
BinaryConstant, BooleanConstant, EqualityComparisonExpression,
FloatConstant, FollowedByObservationExpression,
GreaterThanComparisonExpression,
GreaterThanEqualComparisonExpression, HashConstant,
HexConstant, InComparisonExpression, IntegerConstant,
IsSubsetComparisonExpression,
IsSupersetComparisonExpression,
LessThanComparisonExpression,
LessThanEqualComparisonExpression,
LikeComparisonExpression, ListConstant,
ListObjectPathComponent, MatchesComparisonExpression,
ObjectPath, ObservationExpression, OrBooleanExpression,
OrObservationExpression, ParentheticalExpression,
QualifiedObservationExpression,
ReferenceObjectPathComponent, RepeatQualifier,
StartStopQualifier, StringConstant, TimestampConstant,
WithinQualifier
GreaterThanComparisonExpression, GreaterThanEqualComparisonExpression,
HashConstant, HexConstant, InComparisonExpression, IntegerConstant,
IsSubsetComparisonExpression, IsSupersetComparisonExpression,
LessThanComparisonExpression, LessThanEqualComparisonExpression,
LikeComparisonExpression, ListConstant, ListObjectPathComponent,
MatchesComparisonExpression, ObjectPath, ObservationExpression,
OrBooleanExpression, OrObservationExpression, ParentheticalExpression,
QualifiedObservationExpression, ReferenceObjectPathComponent,
RepeatQualifier, StartStopQualifier, StringConstant, TimestampConstant,
WithinQualifier,
)
from .utils import new_version, revoke
from .v20 import * # This import will always be the latest STIX 2.X version

View File

@ -884,9 +884,10 @@ def test_parse_observable_with_custom_extension():
assert parsed.extensions['x-new-ext'].property2 == 12
@pytest.mark.parametrize("data", [
# URL is not in EXT_MAP
"""{
@pytest.mark.parametrize(
"data", [
# URL is not in EXT_MAP
"""{
"type": "url",
"value": "example.com",
"extensions": {
@ -896,8 +897,8 @@ def test_parse_observable_with_custom_extension():
}
}
}""",
# File is in EXT_MAP
"""{
# File is in EXT_MAP
"""{
"type": "file",
"name": "foo.txt",
"extensions": {
@ -907,7 +908,8 @@ def test_parse_observable_with_custom_extension():
}
}
}""",
])
],
)
def test_parse_observable_with_unregistered_custom_extension(data):
with pytest.raises(ValueError) as excinfo:
stix2.parse_observable(data, version='2.0')

View File

@ -289,7 +289,7 @@ def test_memory_store_object_creator_of_present(mem_store):
iden = Identity(
id="identity--e4196283-7420-4277-a7a3-d57f61ef1389",
name="Foo Corp.",
identity_class="corporation"
identity_class="corporation",
)
mem_store.add(camp)

View File

@ -888,9 +888,10 @@ def test_parse_observable_with_custom_extension():
assert parsed.extensions['x-new-ext'].property2 == 12
@pytest.mark.parametrize("data", [
# URL is not in EXT_MAP
"""{
@pytest.mark.parametrize(
"data", [
# URL is not in EXT_MAP
"""{
"type": "url",
"value": "example.com",
"extensions": {
@ -900,8 +901,8 @@ def test_parse_observable_with_custom_extension():
}
}
}""",
# File is in EXT_MAP
"""{
# File is in EXT_MAP
"""{
"type": "file",
"name": "foo.txt",
"extensions": {
@ -911,7 +912,8 @@ def test_parse_observable_with_custom_extension():
}
}
}""",
])
],
)
def test_parse_observable_with_unregistered_custom_extension(data):
with pytest.raises(ValueError) as excinfo:
stix2.parse_observable(data, version='2.1')

View File

@ -10,7 +10,7 @@ from stix2.v21 import (
Bundle, Campaign, CustomObject, Identity, Indicator, Malware, Relationship,
)
from stix2.test.v21.constants import (
from .constants import (
CAMPAIGN_ID, CAMPAIGN_KWARGS, IDENTITY_ID, IDENTITY_KWARGS, INDICATOR_ID,
INDICATOR_KWARGS, MALWARE_ID, MALWARE_KWARGS, RELATIONSHIP_IDS,
)
@ -296,7 +296,7 @@ def test_memory_store_object_creator_of_present(mem_store):
iden = Identity(
id="identity--e4196283-7420-4277-a7a3-d57f61ef1389",
name="Foo Corp.",
identity_class="corporation"
identity_class="corporation",
)
mem_store.add(camp)