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

Fix for issue #572 #607

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

HackerShark
Copy link

Issue #572 errors when longitude or latitude has a 0 value. This fix takes into account 0 values for longitude and latitude.

… error on those values

Signed-off-by: HackerShark <melsharkawi@mitre.org>
…and latitude

Signed-off-by: HackerShark <melsharkawi@mitre.org>
@CLAassistant
Copy link

CLAassistant commented Oct 17, 2024

CLA assistant check
All committers have signed the CLA.

Signed-off-by: HackerShark <melsharkawi@mitre.org>
Signed-off-by: HackerShark <melsharkawi@mitre.org>
@rpiazza
Copy link
Contributor

rpiazza commented Oct 17, 2024

Seems line two tests failed this time. Before you push again, run the tests in pycharm. Just click right on test-location.py and select test

Signed-off-by: HackerShark <melsharkawi@mitre.org>
@rpiazza
Copy link
Contributor

rpiazza commented Oct 18, 2024

Some other test, not in test-location.py, failed . Can you look into that?

@rpiazza
Copy link
Contributor

rpiazza commented Oct 24, 2024

It seems to be failing in the v20 tests

Any progress?

…in behavior caused the fail because is_encrypted is set to False which is a falsy value. Adjusted the code to handle both None and other falsy values

Signed-off-by: HackerShark <melsharkawi@mitre.org>
@HackerShark
Copy link
Author

Tested the code locally and it passed. This fix should be correct.

@rpiazza
Copy link
Contributor

rpiazza commented Oct 25, 2024

Some minor style issues. If you fix them I can merge :-)

Signed-off-by: HackerShark <melsharkawi@mitre.org>
@chisholm
Copy link
Contributor

This is still incorrect. A boolean property can be False and present:

class FalseyTest(_STIXBase):
    _type = "falsey"
    _properties = {
        "type": TypeProperty(_type, spec_version='2.1'),
        "id": IDProperty(_type, spec_version='2.1'),
        "foo": StringProperty(),
        "falsey1": BooleanProperty(),
    }

    def _check_object_constraints(self):
        super()._check_object_constraints()
        super()._check_properties_dependency(["falsey1"], ["foo"])

# Should not throw since both props are present.
FalseyTest(foo="bar", falsey1=False)

still yields:

stix2.exceptions.DependentPropertiesError: The property dependencies for FalseyTest: (falsey1, foo) are not met.

The problem is that a falsey test was done in a context where it did not correctly substitute for a presence test. Sometimes you can get away with that, sometimes you can't. A direct presence test is better here, e.g. if p in self....

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.

4 participants