Debian Codegraph @

hypothesis-python/tests/nocover/test_uuids.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 import pytest
12
13 from hypothesis import given, strategies as st
14
15 from tests.common.debug import minimal
16
17
18 @given(st.lists(st.uuids()))
19 def test_are_unique(ls):
20 assert len(set(ls)) == len(ls)
21
22
23 def test_retains_uniqueness_in_simplify():
24 ts = minimal(st.lists(st.uuids()), lambda x: len(x) >= 5)
25 assert len(ts) == len(set(ts)) == 5
26
27
28 @pytest.mark.parametrize("version", (1, 2, 3, 4, 5))
29 def test_can_generate_specified_version(version):
30 @given(st.uuids(version=version))
31 def inner(uuid):
32 assert version == uuid.version
33
34 inner()