Skip to content

uinit test KDTree_2IntTestCase fails in test_count_within_range #11

@coldtobi

Description

@coldtobi

the test marked with "-->"


    def test_count_within_range(self):
        nn = KDTree_2Int()

        for p in [(0, 0), (1, 0), (0, 1), (1, 1)]:
            nn.add((p, id(p)))

        res = nn.count_within_range((0, 0), 1)
-->   self.assertEqual(3, res, "Counted %i points instead of %i" % (res, 3))

        res = nn.count_within_range((0, 0), 1.9)
        self.assertEqual(4, res, "Counted %i points instead of %i" % (res, 4))

fails with:

1: ======================================================================
1: FAIL: test_count_within_range (py_kdtree_test.KDTree_2IntTestCase.test_count_within_range)
1: ----------------------------------------------------------------------
1: Traceback (most recent call last):
1:   File "/build/libkdtree++-0.7.5/python-bindings/py_kdtree_test.py", line 120, in test_count_within_range
1:     self.assertEqual(3, res, "Counted %i points instead of %i" % (res, 3))
1:     ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1: AssertionError: 3 != 4 : Counted 4 points instead of 3
1: 

The Debian "solution" used in the package was to disable the test, but I'm not sure if that is just hiding a problem.
(link to the "patch": https://salsa.debian.org/debian/libkdtreepp/-/blob/master/debian/patches/disable-improper-test.patch?ref_type=heads

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions