Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support STIX 2.1 version precision #374

Merged
merged 6 commits into from
Apr 3, 2020

Conversation

chisholm
Copy link
Contributor

Fixes #350 , #329

The new rules say versioning timestamps need at least millisecond precision; the old ones said exactly millisecond precision. So we are able to allow more precision in those timestamps now. This PR adds support for expressing and enforcing a minimum precision on versioning timestamps.

@chisholm
Copy link
Contributor Author

There is a test failure specific to Python 3.6. I think it might be a result of:

https://bugs.python.org/issue32404

My unit test uses utcnow() whereas the bug report describes fromtimestamp(), but I think both methods invoke the same underlying code which contains the bug. This is not something we can fix. All we can do is work around it for that particular unit test and version of Python.

@codecov-io
Copy link

codecov-io commented Mar 18, 2020

Codecov Report

Merging #374 into master will increase coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #374      +/-   ##
==========================================
+ Coverage   98.18%   98.19%   +0.01%     
==========================================
  Files         124      125       +1     
  Lines       14238    14333      +95     
==========================================
+ Hits        13980    14075      +95     
  Misses        258      258              
Impacted Files Coverage Δ
stix2/test/v21/test_attack_pattern.py 100.00% <ø> (ø)
stix2/v21/common.py 100.00% <ø> (ø)
stix2/v21/sdo.py 94.44% <ø> (ø)
stix2/v21/sro.py 94.73% <ø> (ø)
stix2/properties.py 98.36% <100.00%> (+<0.01%) ⬆️
stix2/test/v21/test_timestamp_precision.py 100.00% <100.00%> (ø)
stix2/test/v21/test_versioning.py 100.00% <100.00%> (ø)
stix2/utils.py 97.64% <100.00%> (+0.46%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6842abb...1741cc9. Read the comment docs.

@emmanvg emmanvg added this to the 1.4.0 milestone Apr 3, 2020
Copy link
Contributor

@clenk clenk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM; thanks @chisholm!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Constraint on number of digits in created and modified properties has changed
4 participants