Merge pull request #63 from oasis-open/fix-timestamp_constant

Fix timestamp constant
stix2.1
Greg Back 2017-10-05 23:03:03 +01:00 committed by GitHub
commit 58f39f80af
2 changed files with 6 additions and 1 deletions

View File

@ -24,7 +24,7 @@ class TimestampConstant(_Constant):
self.value = value
def __str__(self):
return "'%s'" % escape_quotes_and_backslashes(self.value)
return "t'%s'" % escape_quotes_and_backslashes(self.value)
class IntegerConstant(_Constant):

View File

@ -170,3 +170,8 @@ def test_set_op():
exp = stix2.ObservationExpression(stix2.IsSubsetComparisonExpression("network-traffic:dst_ref.value",
"2001:0db8:dead:beef:0000:0000:0000:0000/64"))
assert str(exp) == "[network-traffic:dst_ref.value ISSUBSET '2001:0db8:dead:beef:0000:0000:0000:0000/64']"
def test_timestamp():
ts = stix2.TimestampConstant('2014-01-13T07:03:17Z')
assert str(ts) == "t'2014-01-13T07:03:17Z'"