Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@given(st.lists(st.binary(min_size=1024, max_size=1024), average_size=100))
@settings(database=None, buffer_size=1000)
def test(x):
pass
def write_pattern(draw, min_size=0):
keys = draw(st.lists(st.integers(0, 1000), unique=True, min_size=1))
values = draw(st.lists(st.integers(), unique=True, min_size=1))
return draw(
st.lists(st.tuples(st.sampled_from(keys), st.sampled_from(values)),
min_size=min_size))
def test_can_find_nans():
x = find(lists(floats()), lambda x: math.isnan(sum(x)))
if len(x) == 1:
assert math.isnan(x[0])
else:
assert 2 <= len(x) <= 3
def two_lists_equal_size(draw):
list_one = draw(st.lists(float_st, min_size=1))
size = len(list_one)
list_two = draw(st.lists(float_st_nz, min_size=size, max_size=size))
return list_one, list_two
@given(st.lists(st.integers(), min_size=1))
def test_smallest_random(values):
int_heap = IntHeap()
for v in values:
heap.push(int_heap, v)
target = random.choice(int_heap.values)
valid = [i for (i, v) in enumerate(int_heap.values) if v == target]
assert heap.smallest(int_heap, (lambda x: x == target)) in valid
st.lists(concave_terms(), min_size=1),
)
def test_unknown(self, a, b):
terms = a + b
for c, _ in terms:
assume(c != 0.0)
cvx = self._rule_result(terms)
assert cvx.is_unknown()
lambda children: st.builds(
lambda x: encode_octet_string(x), st.one_of(children)
)
| st.builds(lambda x: encode_bitstring(x, 0), st.one_of(children))
| st.builds(
lambda x: encode_sequence(*x), st.lists(children, max_size=200)
)
| st.builds(
lambda tag, x: encode_constructed(tag, x),
st.integers(min_value=0, max_value=0x3F),
st.one_of(children),
),
import unittest
from hypothesis import given
import hypothesis.strategies as st
from hypothesis.extra.datetime import dates
from arcas.PLOS.main import Plos
plos_entry = st.fixed_dictionaries(
{'id': st.text(min_size=5, max_size=5),
'journal': st.text(min_size=5, max_size=5),
'article_type': st.text(min_size=5, max_size=5),
'author_display': st.lists(elements=st.text(min_size=5,
max_size=5),
min_size=5, max_size=5,
unique=True),
'abstract': st.text(min_size=5, max_size=5),
'title_display': st.text(min_size=5, max_size=5),
'score': st.text(min_size=5, max_size=5)
})
dummy_arguments = st.fixed_dictionaries(
{'-a': st.text(min_size=5, max_size=5),
'-t': st.text(min_size=5, max_size=5),
'-b': st.text(min_size=5, max_size=5),
'-y': st.text(min_size=5, max_size=5),
'-r': st.text(min_size=5, max_size=5),
'-s': st.text(min_size=5, max_size=5)
})
metrics=st.lists(st.text(), min_size=2).filter(
lambda x: len(set(x)) != len(x)
)
),
dict(
metrics=cst.everything_except((str, Sequence))
| st.lists(cst.everything_except(str))
),
dict(
nrows=cst.everything_except((Integral, type(None)))
| st.integers(max_value=0)
),
dict(
ncols=cst.everything_except((Integral, type(None)))
| st.integers(max_value=0)
),
dict(
lambda x: one_of(
lists(x, max_size=2),
tuples(x),
dictionaries(unqualified_identifiers, x, max_size=2),
).map(py.Literal),
max_leaves=8,