Download minigpt2/lib/python3.10/site-packages/referencing/tests/test_exceptions.py from ZTWHHH/envs_2: direct link, hf CLI and curl.
- Browser
- Download file 934 Bytes
-
https://huggingface.co/datasets/ZTWHHH/envs_2/resolve/main/minigpt2/lib/python3.10/site-packages/referencing/tests/test_exceptions.py
- Command line
-
hf download hf://datasets/ZTWHHH/envs_2/minigpt2/lib/python3.10/site-packages/referencing/tests/test_exceptions.py
-
curl -L -o test_exceptions.py https://huggingface.co/datasets/ZTWHHH/envs_2/resolve/main/minigpt2/lib/python3.10/site-packages/referencing/tests/test_exceptions.py
934 Bytes
| import itertools | |
| import pytest | |
| from referencing import Resource, exceptions | |
| def pairs(choices): | |
| return itertools.combinations(choices, 2) | |
| TRUE = Resource.opaque(True) | |
| thunks = ( | |
| lambda: exceptions.CannotDetermineSpecification(TRUE), | |
| lambda: exceptions.NoSuchResource("urn:example:foo"), | |
| lambda: exceptions.NoInternalID(TRUE), | |
| lambda: exceptions.InvalidAnchor(resource=TRUE, anchor="foo", ref="a#b"), | |
| lambda: exceptions.NoSuchAnchor(resource=TRUE, anchor="foo", ref="a#b"), | |
| lambda: exceptions.PointerToNowhere(resource=TRUE, ref="urn:example:foo"), | |
| lambda: exceptions.Unresolvable("urn:example:foo"), | |
| lambda: exceptions.Unretrievable("urn:example:foo"), | |
| ) | |
| def test_eq_incompatible_types(one, two): | |
| assert one != two | |
| def test_hash(thunk): | |
| assert thunk() in {thunk()} | |