Skip to content

Commit

Permalink
Fixed doctests
Browse files Browse the repository at this point in the history
  • Loading branch information
Erotemic committed Aug 3, 2019
1 parent 7a51dcf commit 3563352
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion boltons/fileutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ def from_path(cls, path):
Here's an example that holds true on most systems:
>>> import tempfile
>>> 'r' in FilePerms.from_path(tempfile.tempdir).user
>>> 'r' in FilePerms.from_path(tempfile.gettempdir()).user
True
"""
stat_res = os.stat(path)
Expand Down
12 changes: 6 additions & 6 deletions boltons/statsutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -583,12 +583,12 @@ def format_histogram(self, bins=None, **kw):
allowing for simple visualization, even in console environments.
>>> data = list(range(20)) + list(range(5, 15)) + [10]
>>> print(Stats(data).format_histogram())
0.0: 5 ################################
4.4: 8 ###################################################
8.9: 11 ######################################################################
13.3: 5 ################################
17.8: 2 #############
>>> print(Stats(data).format_histogram(width=30))
0.0: 5 #########
4.4: 8 ###############
8.9: 11 ####################
13.3: 5 #########
17.8: 2 ####
In this histogram, five values are between 0.0 and 4.4, eight
are between 4.4 and 8.9, and two values lie between 17.8 and
Expand Down
4 changes: 2 additions & 2 deletions boltons/urlutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1021,7 +1021,7 @@ class OrderedMultiDict(dict):
>>> from pprint import pprint as pp # ensuring proper key ordering
>>> omd = OrderedMultiDict([('a', 1), ('b', 2), ('a', 3)])
>>> pp(dict(omd))
{'a': [1, 3], 'b': [2]}
{'a': 3, '': 2}
Note that modifying those lists will modify the OMD. If you want a
safe-to-modify or flat dictionary, use :meth:`OrderedMultiDict.todict()`.
Expand Down Expand Up @@ -1377,7 +1377,7 @@ def sorted(self, key=None, reverse=False):
>>> omd = OrderedMultiDict(zip('hello', 'world'))
>>> omd.sorted(key=lambda i: i[1]) # i[0] is the key, i[1] is the val
OrderedMultiDict([('o', 'd'), ('l', 'l'), ('e', 'o'), ('h', 'w')])
OrderedMultiDict([('o', 'd'), ('l', 'l'), ('e', 'o'), ('l', 'r'), ('h', 'w')])
"""
cls = self.__class__
return cls(sorted(self.iteritems(), key=key, reverse=reverse))
Expand Down

0 comments on commit 3563352

Please sign in to comment.