Skip to content

Commit c640d5e

Browse files
committed
fix some doctests
1 parent 13d989b commit c640d5e

3 files changed

Lines changed: 16 additions & 8 deletions

File tree

docs/conf.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
# add these directories to sys.path here. If the directory is relative to the
2020
# documentation root, use os.path.abspath to make it absolute, like shown here.
2121
sys.path.insert(0, os.path.abspath('..'))
22+
import nameparser
2223

2324
# -- General configuration ------------------------------------------------
2425

@@ -55,7 +56,7 @@
5556
# built documents.
5657
#
5758
# The short X.Y version.
58-
version = '0.3'
59+
version = nameparser.__version__
5960
# The full version, including alpha/beta/rc tags.
6061
release = '0.3a1'
6162

docs/customize.rst

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ that "Hon" can be parsed as a first name.
4040
nickname: ''
4141
]>
4242
>>> from nameparser.config import CONSTANTS
43-
>>> CONSTANTS.titles.remove('hon')
43+
>>> CONSTANTS.titles.remove('hon') # doctest: +ELLIPSIS
44+
SetManager(set([u'msgt', ..., u'adjutant']))
4445
>>> hn = HumanName("Hon Solo")
4546
>>> hn
4647
<HumanName : [
@@ -64,7 +65,8 @@ methods and each string will be added or removed.
6465

6566
>>> from nameparser import HumanName
6667
>>> from nameparser.config import CONSTANTS
67-
>>> CONSTANTS.titles.add('dean', 'Chemistry')
68+
>>> CONSTANTS.titles.add('dean', 'Chemistry') # doctest: +ELLIPSIS
69+
SetManager(set([u'msgt', ..., u'adjutant']))
6870
>>> hn = HumanName("Assoc Dean of Chemistry Robert Johns")
6971
>>> hn
7072
<HumanName : [
@@ -89,7 +91,8 @@ the config on one instance could modify the behavior of another instance.
8991

9092
>>> from nameparser import HumanName
9193
>>> hn = HumanName("Dean Robert Johns")
92-
>>> hn.C.titles.add('dean')
94+
>>> hn.C.titles.add('dean') # doctest: +ELLIPSIS
95+
SetManager(set([u'msgt', ..., u'adjutant']))
9396
>>> hn
9497
<HumanName : [
9598
title: 'Dean'
@@ -121,7 +124,8 @@ reference to the module-level config values with the behavior described above.
121124

122125
>>> from nameparser import HumanName
123126
>>> hn = HumanName("Dean Robert Johns", None)
124-
>>> hn.C.titles.add('dean')
127+
>>> hn.C.titles.add('dean') # doctest: +ELLIPSIS
128+
SetManager(set([u'msgt', ..., u'adjutant']))
125129
>>> hn
126130
<HumanName : [
127131
title: 'Dean'
@@ -168,7 +172,8 @@ those changes with ``repr()``.
168172
suffix: ''
169173
nickname: ''
170174
]>
171-
>>> hn.C.titles.add('dean')
175+
>>> hn.C.titles.add('dean') # doctest: +ELLIPSIS
176+
SetManager(set([u'msgt', ..., u'adjutant']))
172177
>>> hn
173178
<HumanName : [
174179
title: 'Dean'

nameparser/config/__init__.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
::
1111
1212
>>> from nameparser.config import CONSTANTS
13-
>>> constants.titles.remove('hon').add('chemistry','dean')
13+
>>> CONSTANTS.titles.remove('hon').add('chemistry','dean') # doctest: +ELLIPSIS
14+
SetManager(set([u'msgt', ..., u'adjutant']))
1415
1516
You can also adjust the configuration of individual instances by passing
1617
``None`` as the second argument upon instantiation.
@@ -19,7 +20,8 @@
1920
2021
>>> from nameparser import HumanName
2122
>>> hn = HumanName("Dean Robert Johns", None)
22-
>>> hn.C.titles.add('dean')
23+
>>> hn.C.titles.add('dean') # doctest: +ELLIPSIS
24+
SetManager(set([u'msgt', ..., u'adjutant']))
2325
>>> hn.parse_full_name() # need to run this again after config changes
2426
2527
**Potential Gotcha**: If you do not pass ``None`` as the second argument,

0 commit comments

Comments
 (0)