Debian Codegraph @

hypothesis-python/examples/example_hypothesis_entrypoint/test_entrypoint.py

raw
1 # This file is part of Hypothesis, which may be found at
2 # https://github.com/HypothesisWorks/hypothesis/
3 #
4 # Copyright the Hypothesis Authors.
5 # Individual contributors are listed in AUTHORS.rst and the git log.
6 #
7 # This Source Code Form is subject to the terms of the Mozilla Public License,
8 # v. 2.0. If a copy of the MPL was not distributed with this file, You can
9 # obtain one at https://mozilla.org/MPL/2.0/.
10
11 from example_hypothesis_entrypoint import MyCustomType
12
13 from hypothesis import given, strategies as st
14
15
16 @given(st.from_type(MyCustomType))
17 def test_registered_from_entrypoint(x):
18 # This demonstrates that we've registered the type, not just
19 # worked out how to construct an instance.
20 assert isinstance(x, MyCustomType)
21 assert x.x >= 0