Skip to content

Commit

Permalink
Fixes doctest for python3
Browse files Browse the repository at this point in the history
Dictionary hash are dynamic in Python3 so the __repr__ output will be different all the time. Doctest should check for value equality instead. Monotonic nested defaultdict/dictionary outputs should not be affected though.

Fixes issue on https://nltk.ci.cloudbees.com/job/nltk/TOXENV=py34-jenkins,jdk=jdk8latestOnlineInstall/lastCompletedBuild/testReport/nltk.util/Trie/as_dict/

(Same issue as a488bb6)

@stevenbird Sorry I presented the wrong radio button in the previous commit when fixing a488bb6
  • Loading branch information
alvations committed Feb 26, 2016
1 parent a488bb6 commit 80b3b1d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions nltk/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -1332,8 +1332,9 @@ def as_dict(self, d=None):
>>> from nltk.util import Trie
>>> trie = Trie(["abc", "def"])
>>> trie.as_dict()
{'a': {'b': {'c': {True: None}}}, 'd': {'e': {'f': {True: None}}}}
>>> expected = {'a': {'b': {'c': {True: None}}}, 'd': {'e': {'f': {True: None}}}}
>>> trie.as_dict() == expected
True
"""
def _default_to_regular(d):
Expand Down

0 comments on commit 80b3b1d

Please sign in to comment.