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_bounds_array())
def test_bounds_array_generation(bounds_array):
assert bounds_array.shape[1] % 2 == 0
n = bounds_array.shape[1] // 2
for d in range(n):
assert np.all(bounds_array[:, d + n] >= bounds_array[:, d])
@given(endpoint=text())
@patch('pokebase.interface.get_data')
def testArg_endpoint_Text(self, mock_get_data, endpoint):
mock_get_data.side_effect = ValueError()
with self.assertRaises(ValueError):
interface.APIResourceList(endpoint)
@given(builds(Litter, integers(), integers()))
def test_named_tuples_are_of_right_type(litter):
assert isinstance(litter, Litter)
@given(booleans())
def test_hash_mirrors_eq(self, eq):
"""
If `hash` is None, the hash generation mirrors `eq`.
"""
C = make_class("C", {"a": attr.ib()}, eq=eq, frozen=True)
i = C(1)
assert i == i
assert hash(i) == hash(i)
if eq:
assert C(1) == C(1)
assert hash(C(1)) == hash(C(1))
else:
assert C(1) != C(1)
@given(integers(), integers())
def test_too_many_positional(x):
pass
@given((text() | binary()).filter(not_a_number))
def test_returns_default_value_if_given_invalid_string(self, x):
assert fastnumbers.fast_int(x, default=90) == 90
assert fastnumbers.fast_int(x, 90) == 90
@given(_CONTEXT_STRATEGY, strategies.sampled_from(_DEVICE_DATA))
@settings(max_examples=5)
def test_sys_path(self, a_context, device_datum):
device = Devices.from_path(a_context, device_datum.device_path)
assert device.sys_path == device_datum.sys_path
assert is_unicode_string(device.sys_path)
@given(dist=distribution_structures(size=2, alphabet=(2, 4), uniform=False))
def test_distribution_structures3(dist):
"""
A test for the distributions strategy.
"""
assert dist.outcome_length() == 2
assert set(dist.alphabet[0]) <= {0, 1, 2, 3}
@given(df_strategy())
def test_encode_categorical_missing_column(df):
with pytest.raises(AssertionError):
df.encode_categorical("aloha")
@given(data())
def test_select_and_commnads(data):
app = demo2_app()
index = data.draw(integers(min_value=0, max_value=10000))
names = data.draw(lists(sampled_from(method_names), min_size=5,
max_size=100))
select_item_at_index(app, index)
a1, b1 = outline_shapes(app)
for name in names:
meth = getattr(app, name)
meth()
print(name)
app.processEvents()
if method_names.index(name) > 5:
# possible change in the outline