Skip to content

Commit

Permalink
Complete strategies
Browse files Browse the repository at this point in the history
  • Loading branch information
lycantropos committed May 19, 2020
1 parent 38aa3db commit 07d6cc0
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions tests/planar_tests/strategies.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,18 @@
max_size=2)))


def points_to_segments_lists(points: Strategy[Point]
) -> Strategy[List[Segment]]:
def points_to_segments_list(points: List[Point]) -> List[Segment]:
return list(combinations(points, 2))
def points_to_nets(points: Strategy[Point]) -> Strategy[List[Segment]]:
def to_net(points_list: List[Point]) -> List[Segment]:
return list(combinations(points_list, 2))

return (strategies.lists(points,
min_size=2,
max_size=8,
unique=True)
.map(points_to_segments_list))
.map(to_net))


nets = points_strategies.flatmap(points_to_segments_lists)
nets = points_strategies.flatmap(points_to_nets)
segments_lists = (segments_strategies.flatmap(strategies.lists)
| nets)
empty_segments_lists = strategies.builds(list)
Expand Down

0 comments on commit 07d6cc0

Please sign in to comment.