question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

test_sections.py fails locally

See original GitHub issue

On my setup test_geometry_from_points() and test_nested_compound_geometry_from_points() fails. See below output:

_____________________________________________________________ test_geometry_from_points ______________________________________________________________

    def test_geometry_from_points():
        # Geometry.from_points() tests a shape with exactly one exterior
        # and an arbitrary number of interiors being built from the legacy
        # points, facets, holes, control_points interface of sectionproperties
        exterior = [[-6, 10], [6, 10], [6, -10], [-6, -10]]
        interior1 = [[-4, 8], [4, 8], [4, 4], [-4, 4]]
        interior2 = [[-4, -8], [4, -8], [4, -4], [-4, -4]]
        points = exterior + interior1 + interior2
        facets = [
            [0, 1],
            [1, 2],
            [2, 3],
            [3, 0],
            [4, 5],
            [5, 6],
            [6, 7],
            [7, 4],
            [8, 9],
            [9, 10],
            [10, 11],
            [11, 7],
        ]
        control_points = [[0, 0]]
        holes = [[0, 6], [0, -6]]
        new_geom = Geometry.from_points(points=points, facets=facets, control_points=control_points, holes=holes)
>       assert (
            new_geom.geom.wkt
            == "POLYGON ((6 10, 6 -10, -6 -10, -6 10, 6 10), (-4 4, 4 4, 4 8, -4 8, -4 4), (4 -8, 4 -4, -4 -4, -4 -8, 4 -8))"
        )  # Note, the order of point coordinates can change based on geometry operations, e.g. +/- and how many; seems to be a shapely issue
E       AssertionError: assert 'POLYGON ((-6...4 -4, -4 -8))' == 'POLYGON ((6 ...-4 -8, 4 -8))'
E         - POLYGON ((6 10, 6 -10, -6 -10, -6 10, 6 10), (-4 4, 4 4, 4 8, -4 8, -4 4), (4 -8, 4 -4, -4 -4, -4 -8, 4 -8))
E         ?                                  ------                               -------                    ------
E         + POLYGON ((-6 10, 6 10, 6 -10, -6 -10, -6 10), (-4 8, -4 4, 4 4, 4 8, -4 8), (-4 -8, 4 -8, 4 -4, -4 -4, -4 -8))
E         ?           +       ++++++                          ++++++                 +  +        ++++++

sectionproperties/tests/test_sections.py:82: AssertionError
_____________________________________________________ test_nested_compound_geometry_from_points ______________________________________________________

    def test_nested_compound_geometry_from_points():
        """
        Tests a nested compound geometry can be built .from_points, that the control_points
        and hole nodes persist in the right locations, and that ...
        """
        points = [
            [-50.0, 50.0],
            [50.0, 50.0],
            [50.0, -50.0],
            [-50.0, -50.0],
            [37.5, -37.5],
            [37.5, 37.5],
            [-37.5, 37.5],
            [-37.5, -37.5],
            [25.0, -25.0],
            [25.0, 25.0],
            [-25.0, 25.0],
            [-25.0, -25.0],
            [12.5, -12.5],
            [12.5, 12.5],
            [-12.5, 12.5],
            [-12.5, -12.5],
        ]
        facets = [
            [0, 1],
            [1, 2],
            [2, 3],
            [3, 0],
            [4, 5],
            [5, 6],
            [6, 7],
            [7, 4],
            [8, 9],
            [9, 10],
            [10, 11],
            [11, 8],
            [12, 13],
            [13, 14],
            [14, 15],
            [15, 12],
        ]
        control_points = [[-43.75, 0.0], [-31.25, 0.0], [-18.75, 0.0]]
        holes = [[0, 0]]
        nested_compound = CompoundGeometry.from_points(
            points=points, facets=facets, control_points=control_points, holes=holes
        )
>       assert (
            nested_compound.geom.wkt
            == "MULTIPOLYGON (((50 50, 50 -50, -50 -50, -50 50, 50 50), (12.5 12.5, -12.5 12.5, -12.5 -12.5, 12.5 -12.5, 12.5 12.5)), ((-37.5 -37.5, -37.5 37.5, 37.5 37.5, 37.5 -37.5, -37.5 -37.5), (12.5 12.5, -12.5 12.5, -12.5 -12.5, 12.5 -12.5, 12.5 12.5)), ((-25 -25, -25 25, 25 25, 25 -25, -25 -25), (12.5 12.5, -12.5 12.5, -12.5 -12.5, 12.5 -12.5, 12.5 12.5)))"
        )
E       AssertionError: assert 'MULTIPOLYGON...12.5 -12.5)))' == 'MULTIPOLYGON... 12.5 12.5)))'
E         - MULTIPOLYGON (((50 50, 50 -50, -50 -50, -50 50, 50 50), (12.5 12.5, -12.5 12.5, -12.5 -12.5, 12.5 -12.5, 12.5 12.5)), ((-37.5 -37.5, -37.5 37.5, 37.5 37.5, 37.5 -37.5, -37.5 -37.5), (12.5 12.5, -12.5 12.5, -12.5 -12.5, 12.5 -12.5, 12.5 12.5)), ((-25 -25, -25 25, 25 25, 25 -25, -25 -25), (12.5 12.5, -12.5 12.5, -12.5 -12.5, 12.5 -12.5, 12.5 12.5)))
E         + MULTIPOLYGON (((-50 50, 50 50, 50 -50, -50 -50, -50 50), (12.5 -12.5, 12.5 12.5, -12.5 12.5, -12.5 -12.5, 12.5 -12.5)), ((37.5 -37.5, -37.5 -37.5, -37.5 37.5, 37.5 37.5, 37.5 -37.5), (12.5 -12.5, 12.5 12.5, -12.5 12.5, -12....
E         
E         ...Full output truncated (1 line hidden), use '-vv' to show

sectionproperties/tests/test_sections.py:176: AssertionError

The geometries appear to be identitcal however the point ordering differs - I see you’ve noted this in a comment but would be great to not have these fail for this arbitray reason?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
connorferstercommented, Dec 31, 2021

Got it. In the process of merging/updating the library... branch. Will check that out when I finish.

1reaction
robbievanleeuwencommented, Dec 31, 2021

Yep was on v2 for me.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Test discovery failure when tests in different directories are ...
Using py.test, two tests called the same in different directory causes py.test to fail. Why is that? How can I change this without...
Read more >
test fail to run when using tox locally · Issue #418 - GitHub
Not sure if I'm doing something wrong but I get a series of ImportError lines if I run tox locally. If I add...
Read more >
Error when running tests locally - fastai - fast.ai Course Forums
I am getting the following error when running tests (I execute pytest from the test ... ERROR collecting tests/test_mod_independency.py ...
Read more >
1926362 – python-odml fails to build with Python 3.10: AttributeError ...
Bug 1926362 - python-odml fails to build with Python 3.10: ... TestSection testMethod=test_extend> def test_extend(self): sec = Section(name="main") self.
Read more >
App works locally, but fails when uploaded - Google Groups
The full error report is shown below: - Traceback (most recent call last): File "/base/python_lib/versions/1/google/appengine/ext/webapp/ __init__.py", ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found