Skip to content

Commit 9b4ded8

Browse files
committed
repeat doctest in test_api
1 parent 92cc852 commit 9b4ded8

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

tests/test_api.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import click
1010
from click.testing import CliRunner, Result
1111
from docdata import parse_docdata
12+
import pytest
1213

1314
from class_resolver import (
1415
VERSION,
@@ -17,6 +18,7 @@
1718
RegistrationNameConflict,
1819
RegistrationSynonymConflict,
1920
Resolver,
21+
SimpleResolver,
2022
UnexpectedKeywordError,
2123
)
2224

@@ -490,3 +492,18 @@ class AAlt3Base(Alt3Base):
490492
with self.assertRaises(TypeError) as e:
491493
resolver.make("a")
492494
self.assertEqual("surprise!", str(e.exception))
495+
496+
497+
def test_simple_resolver():
498+
"""Test simple resolver."""
499+
sr = SimpleResolver([0, 1, 2, 3])
500+
for i in range(4):
501+
assert sr.make(i) == i
502+
assert sr.make(str(i)) == i
503+
with pytest.raises(ValueError):
504+
sr.make(-1)
505+
with pytest.raises(ValueError):
506+
sr.make(4)
507+
with pytest.raises(ValueError):
508+
sr.make(None)
509+
assert sr.make(None, default=2) == 2

0 commit comments

Comments
 (0)