cti-python-stix2 icon indicating copy to clipboard operation
cti-python-stix2 copied to clipboard

Fix for issue #572

Open HackerShark opened this issue 1 year ago • 3 comments

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

HackerShark avatar Oct 17 '24 17:10 HackerShark

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Oct 17 '24 17:10 CLAassistant

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 avatar Oct 17 '24 19:10 rpiazza

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

rpiazza avatar Oct 18 '24 14:10 rpiazza

It seems to be failing in the v20 tests

Any progress?

rpiazza avatar Oct 24 '24 18:10 rpiazza

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

HackerShark avatar Oct 25 '24 14:10 HackerShark

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

rpiazza avatar Oct 25 '24 15:10 rpiazza

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

chisholm avatar Oct 25 '24 21:10 chisholm

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

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

rpiazza avatar Nov 13 '24 14:11 rpiazza