Skip to content

Commit

Permalink
Complete strategies
Browse files Browse the repository at this point in the history
  • Loading branch information
lycantropos committed Jun 1, 2020
1 parent 312a551 commit 2d26fa7
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion tests/planar_tests/strategies.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
Segment)
from tests.strategies import (points_strategies,
segments_strategies)
from tests.utils import Strategy
from tests.utils import (Strategy,
scale_segment)

contours = points_strategies.flatmap(partial(strategies.lists,
min_size=3))
Expand Down Expand Up @@ -40,6 +41,17 @@ def to_net(points_list: List[Point]) -> List[Segment]:
nets = points_strategies.flatmap(points_to_nets)
segments_lists = (segments_strategies.flatmap(strategies.lists)
| nets)


def to_overlapped_segments(segments: List[Segment],
scale: int) -> List[Segment]:
return segments + [scale_segment(segment,
scale=scale)
for segment in segments]


segments_lists |= strategies.builds(to_overlapped_segments, segments_lists,
strategies.integers(1, 100))
empty_segments_lists = strategies.builds(list)
non_empty_segments_lists = ((segments_strategies
.flatmap(partial(strategies.lists,
Expand Down

0 comments on commit 2d26fa7

Please sign in to comment.