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

Merged
merged 8 commits into from
Dec 2, 2024
Merged

Conversation

HackerShark
Copy link
Contributor

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

@CLAassistant
Copy link

CLAassistant commented Oct 17, 2024

CLA assistant check
All committers have signed the CLA.

@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

@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 <[email protected]>
@HackerShark
Copy link
Contributor 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 :-)

@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....

…e property that way it won't incorrectly raise a DependentPropertiesError

Signed-off-by: HackerShark <[email protected]>
@rpiazza
Copy link
Contributor

rpiazza commented Nov 13, 2024

@HackerShark - still some linty errors - see tox run.

@chisholm - when Mo fixed these errors, and you review his change for me?

@rpiazza rpiazza merged commit 91c09ff into oasis-open:master Dec 2, 2024
5 of 6 checks passed
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