flake-y again
parent
f3526bbfa6
commit
99276c92fc
|
@ -50,7 +50,6 @@ from .patterns import (AndBooleanExpression, AndObservationExpression,
|
|||
ReferenceObjectPathComponent, RepeatQualifier,
|
||||
StartStopQualifier, StringConstant, TimestampConstant,
|
||||
WithinQualifier)
|
||||
from .STIXPatternVisitor import create_pattern_object
|
||||
from .utils import new_version, revoke
|
||||
from .v20 import * # This import will always be the latest STIX 2.X version
|
||||
from .version import __version__
|
||||
|
|
|
@ -5,6 +5,7 @@ import base64
|
|||
import binascii
|
||||
import datetime
|
||||
import re
|
||||
import six
|
||||
|
||||
from .utils import parse_into_datetime
|
||||
|
||||
|
@ -14,7 +15,7 @@ def escape_quotes_and_backslashes(s):
|
|||
|
||||
|
||||
def quote_if_needed(x):
|
||||
if isinstance(x, str):
|
||||
if isinstance(x, six.string_types):
|
||||
if x.find("-") != -1:
|
||||
if not x.startswith("'"):
|
||||
return "'" + x + "'"
|
||||
|
|
|
@ -4,6 +4,8 @@ import pytest
|
|||
|
||||
import stix2
|
||||
|
||||
from stix2.STIXPatternVisitor import create_pattern_object
|
||||
|
||||
|
||||
def test_create_comparison_expression():
|
||||
exp = stix2.EqualityComparisonExpression(
|
||||
|
@ -506,12 +508,12 @@ def test_make_constant_already_a_constant():
|
|||
|
||||
|
||||
def test_parsing_comparison_expression():
|
||||
patt_obj = stix2.create_pattern_object("[file:hashes.'SHA-256' = 'aec070645fe53ee3b3763059376134f058cc337247c978add178b6ccdfb0019f']")
|
||||
patt_obj = create_pattern_object("[file:hashes.'SHA-256' = 'aec070645fe53ee3b3763059376134f058cc337247c978add178b6ccdfb0019f']")
|
||||
assert str(patt_obj) == "[file:hashes.'SHA-256' = 'aec070645fe53ee3b3763059376134f058cc337247c978add178b6ccdfb0019f']"
|
||||
|
||||
|
||||
def test_parsing_qualified_expression():
|
||||
patt_obj = stix2.create_pattern_object(
|
||||
patt_obj = create_pattern_object(
|
||||
"[network-traffic:dst_ref.type = 'domain-name' AND network-traffic:dst_ref.value = 'example.com'] REPEATS 5 TIMES WITHIN 1800 SECONDS")
|
||||
assert str(
|
||||
patt_obj) == "[network-traffic:dst_ref.type = 'domain-name' AND network-traffic:dst_ref.value = 'example.com'] REPEATS 5 TIMES WITHIN 1800 SECONDS"
|
||||
|
|
Loading…
Reference in New Issue