File: conftest.py

package info (click to toggle)
sorted-nearest 0.0.38%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 272 kB
  • sloc: python: 212; sh: 13; makefile: 7
file content (20 lines) | stat: -rw-r--r-- 493 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
from hypothesis import given
from hypothesis.extra.pandas import data_frames, columns, range_indexes
import hypothesis.strategies as st


positions = st.integers(min_value=0, max_value=int(1e7))


def mysort(pos1, pos2):

    if pos1 > pos2:
        return pos2, pos1
    elif pos2 > pos1:
        return pos1, pos2
    else:
        return pos1, pos2 + 1


dfs = data_frames(columns=columns("Start End".split(), dtype=int),
                  rows=st.tuples(positions, positions).map(mysort))