From 80b3b1dc6c146d3ee81a8bfc045005c9e308168c Mon Sep 17 00:00:00 2001 From: alvations Date: Sat, 27 Feb 2016 00:27:50 +0100 Subject: [PATCH] Fixes doctest for python3 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 https://github.com/nltk/nltk/commit/a488bb6c900c89ea4d2ca154627fa92093626332) @stevenbird Sorry I presented the wrong radio button in the previous commit when fixing https://github.com/nltk/nltk/commit/a488bb6c900c89ea4d2ca154627fa92093626332 --- nltk/util.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/nltk/util.py b/nltk/util.py index 2af0fb05d7..d04544b8e4 100644 --- a/nltk/util.py +++ b/nltk/util.py @@ -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):