Skip to content

Commit

Permalink
tests: run doctests
Browse files Browse the repository at this point in the history
  • Loading branch information
oliver-sanders committed Jun 17, 2021
1 parent c7eac5a commit cba696c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 11 deletions.
10 changes: 5 additions & 5 deletions jupyter_server/auth/security.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ def passwd(passphrase=None, algorithm='argon2'):
Examples
--------
>>> passwd('mypassword')
'sha1:7cf3:b7d6da294ea9592a9480c8f52e63cd42cfb9dd12'
>>> passwd('mypassword') # doctest: +ELLIPSIS
'argon2:...'
"""
if passphrase is None:
Expand Down Expand Up @@ -94,11 +94,11 @@ def passwd_check(hashed_passphrase, passphrase):
Examples
--------
>>> from jupyter_server.auth.security import passwd_check
>>> passwd_check('argon2:...', 'mypassword')
>>> myhash = passwd('mypassword')
>>> passwd_check(myhash, 'mypassword')
True
>>> passwd_check('argon2:...', 'otherpassword')
>>> passwd_check(myhash, 'otherpassword')
False
>>> passwd_check('sha1:0e112c3ddfce:a68df677475c2b47b6e86d0467eec97ac5f4b85a',
Expand Down
10 changes: 6 additions & 4 deletions jupyter_server/traittypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,15 @@ class name where an object was defined.
'an object'
>>> describe("a", type(object))
'a type'
Definite description:
>>> describe("the", object())
"the object at '0x10741f1b0'"
>>> describe("the", object()) # doctest: +ELLIPSIS
"the object at '0x...'"
>>> describe("the", object)
"the type 'object'"
'the object object'
>>> describe("the", type(object))
"the type 'type'"
'the type type'
Definitely named description:
>>> describe("the", object(), "I made")
'the object I made'
Expand Down
6 changes: 4 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ factory = "jupyter_packaging.npm_builder"
ignore = ["tbump.toml", ".*", "*.yml", "package-lock.json", "bootstrap*"]

[tool.pytest.ini_options]
# Exclude the example tests.
norecursedirs = "examples/*"
addopts = "--doctest-modules"
testpaths = [
"jupyter_server"
]

[tool.tbump.version]
current = "1.9.0.dev0"
Expand Down

0 comments on commit cba696c

Please sign in to comment.