# Path: tests/hypothesis_helper.py
# @st.composite
# def dfs_min2(draw):  # nosec
#     df = draw(better_dfs_min_2)
#     # strand = draw(use_strand)
#     df.loc[:, "End"] += df.Start
# 
#     df.insert(3, "Name", "a")
#     df.insert(4, "Score", 0)
# 
#     # if not strand:
#     #     df = df.drop("Strand", axis=1)
# 
#     gr = PyRanges(df, int64=True)
#     # gr = PyRanges(df)
# 
#     # do not sort like this, use pyranges sort
#     # np.random.seed(draw(st.integers(min_value=0, max_value=int(1e6))))
#     # gr.df = df.reindex(np.random.permutation(df.index.values))
# 
#     return gr
# 
# @st.composite
# def dfs_no_min(draw):  # nosec
#     df = draw(better_dfs_no_min)
#     # strand = draw(use_strand)
#     df.loc[:, "End"] += df.Start
# 
#     df.insert(3, "Name", "a")
#     df.insert(4, "Score", 0)
# 
#     # stranded = draw(st.booleans())
#     # if not strand:
#     #     df = df.drop("Strand", axis=1)
# 
#     gr = PyRanges(df, int64=True)
#     # gr = PyRanges(df)
# 
#     # do not sort like this, use pyranges sort
#     # np.random.seed(draw(st.integers(min_value=0, max_value=int(1e6))))
#     # gr.df = df.reindex(np.random.permutation(df.index.values))
# 
#     return gr


import pytest
import numpy as np
from hypothesis import given, settings, HealthCheck
from hypothesis import reproduce_failure  # pylint: disable=unused-import
from itertools import product
from tests.hypothesis_helper import dfs_min2, dfs_no_min
from os import environ
else:
    max_examples = 100
    deadline = None

strandedness = [False, "same", "opposite"]

binary_methods = [
    "set_union", "set_intersect", "overlap", "nearest", "intersect",
    "subtract", "join"
]

unary_methods = [
    "merge", "sort", "cluster", "pc", "mpc", "spc", "drop_duplicate_positions",
    "drop"
]

method_chain = product(binary_methods, binary_methods)
# cannot start with an operation that makes pyrange unstranded and then try a stranded op
strandedness_chain = list(product(["same", "opposite"], strandedness)) + list(
    product(strandedness, [None]))


@pytest.mark.bedtools
@pytest.mark.parametrize("strandedness_chain,method_chain",
                         product(strandedness_chain, method_chain))
@settings(
    max_examples=max_examples,
    deadline=deadline,
    print_blob=True,
    suppress_health_check=HealthCheck.all())

# Path: tests/hypothesis_helper.py
# @st.composite
# def dfs_min2(draw):  # nosec
#     df = draw(better_dfs_min_2)
#     # strand = draw(use_strand)
#     df.loc[:, "End"] += df.Start
# 
#     df.insert(3, "Name", "a")
#     df.insert(4, "Score", 0)
# 
#     # if not strand:
#     #     df = df.drop("Strand", axis=1)
# 
#     gr = PyRanges(df, int64=True)
#     # gr = PyRanges(df)
# 
#     # do not sort like this, use pyranges sort
#     # np.random.seed(draw(st.integers(min_value=0, max_value=int(1e6))))
#     # gr.df = df.reindex(np.random.permutation(df.index.values))
# 
#     return gr
# 
# @st.composite
# def dfs_no_min(draw):  # nosec
#     df = draw(better_dfs_no_min)
#     # strand = draw(use_strand)
#     df.loc[:, "End"] += df.Start
# 
#     df.insert(3, "Name", "a")
#     df.insert(4, "Score", 0)
# 
#     # stranded = draw(st.booleans())
#     # if not strand:
#     #     df = df.drop("Strand", axis=1)
# 
#     gr = PyRanges(df, int64=True)
#     # gr = PyRanges(df)
# 
#     # do not sort like this, use pyranges sort
#     # np.random.seed(draw(st.integers(min_value=0, max_value=int(1e6))))
#     # gr.df = df.reindex(np.random.permutation(df.index.values))
# 
#     return gr


# Path: tests/test_do_not_error.py
import pytest
import numpy as np
from hypothesis import given, settings, HealthCheck
from hypothesis import reproduce_failure  # pylint: disable=unused-import
from itertools import product
from tests.hypothesis_helper import dfs_min2, dfs_no_min
from os import environ

else:
    max_examples = 100
    deadline = None

strandedness = [False, "same", "opposite"]

binary_methods = [
    "set_union", "set_intersect", "overlap", "nearest", "intersect",
    "subtract", "join"
]

unary_methods = [
    "merge", "sort", "cluster", "pc", "mpc", "spc", "drop_duplicate_positions",
    "drop"
]

method_chain = product(binary_methods, binary_methods)
# cannot start with an operation that makes pyrange unstranded and then try a stranded op
strandedness_chain = list(product(["same", "opposite"], strandedness)) + list(
    product(strandedness, [None]))


@pytest.mark.bedtools
@pytest.mark.parametrize("strandedness_chain,method_chain",
                         product(strandedness_chain, method_chain))
@settings(
    max_examples=max_examples,
    deadline=deadline,
    print_blob=True,
    suppress_health_check=HealthCheck.all())

@given(gr=dfs_no_min(), gr2=dfs_no_min(), gr3=dfs_no_min())  # pylint: disable=no-value-for-parameter