Skip to content

Commit

Permalink
Remove the import doctest
Browse files Browse the repository at this point in the history
  • Loading branch information
longdt219 committed Aug 6, 2015
1 parent 05dd793 commit 768d132
Show file tree
Hide file tree
Showing 59 changed files with 686 additions and 185 deletions.
3 changes: 0 additions & 3 deletions nltk/align/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,3 @@ def _naacl2pair(pair_string):
i, j, p = pair_string.split("-")
return int(i), int(j)

if __name__ == "__main__":
import doctest
doctest.testmod(optionflags=doctest.NORMALIZE_WHITESPACE)
4 changes: 0 additions & 4 deletions nltk/align/bleu_score.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,3 @@ def _brevity_penalty(candidate, references):
return math.exp(1 - r / c)


# run doctests
if __name__ == "__main__":
import doctest
doctest.testmod(optionflags=doctest.ELLIPSIS)
3 changes: 0 additions & 3 deletions nltk/align/gale_church.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,9 +219,6 @@ def parse_token_stream(stream, soft_delimiter, hard_delimiter):
for block_it in split_at(stream, hard_delimiter)]


if __name__ == "__main__":
import doctest
doctest.testmod(optionflags=doctest.NORMALIZE_WHITESPACE)


# Code for test files in nltk_contrib/align/data/*.tok
Expand Down
4 changes: 0 additions & 4 deletions nltk/align/gdfa.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,3 @@ def final_and(a):
final_and(f2e)
return alignment

# run doctests
if __name__ == "__main__":
import doctest
doctest.testmod()
5 changes: 0 additions & 5 deletions nltk/align/ibm1.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,3 @@ def align(self, align_sent):
alignment.append((j, max_align_prob[1]))

return AlignedSent(align_sent.words, align_sent.mots, alignment)

# run doctests
if __name__ == "__main__":
import doctest
doctest.testmod()
4 changes: 0 additions & 4 deletions nltk/align/ibm2.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,3 @@ def align(self, align_sent):

return AlignedSent(align_sent.words, align_sent.mots, alignment)

# run doctests
if __name__ == "__main__":
import doctest
doctest.testmod()
4 changes: 0 additions & 4 deletions nltk/align/ibm3.py
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,3 @@ def align(self, align_sent):

return AlignedSent(align_sent.words, align_sent.mots, alignment)

# run doctests
if __name__ == "__main__":
import doctest
doctest.testmod()
4 changes: 0 additions & 4 deletions nltk/align/phrase_based.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,3 @@ def phrase_extraction(srctext, trgtext, alignment):
bp.update(phrases)
return bp

# run doctests
if __name__ == "__main__":
import doctest
doctest.testmod()
7 changes: 0 additions & 7 deletions nltk/classify/positivenaivebayes.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,3 @@ def demo():
classifier = partial_names_demo(PositiveNaiveBayesClassifier.train)
classifier.show_most_informative_features()

##//////////////////////////////////////////////////////
## Test
##//////////////////////////////////////////////////////

if __name__ == '__main__':
import doctest
doctest.testmod(optionflags=doctest.NORMALIZE_WHITESPACE)
3 changes: 0 additions & 3 deletions nltk/classify/senna.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,4 @@ def setup_module(module):
except OSError:
raise SkipTest("Senna executable not found")

if __name__ == '__main__':
import doctest
doctest.testmod(optionflags=doctest.NORMALIZE_WHITESPACE | doctest.ELLIPSIS)

3 changes: 0 additions & 3 deletions nltk/corpus/reader/sentiwordnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,3 @@ def __str__(self):
def __repr__(self):
return "Senti" + repr(self.synset)

if __name__ == "__main__":
import doctest
doctest.testmod(optionflags=doctest.NORMALIZE_WHITESPACE)
2 changes: 0 additions & 2 deletions nltk/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,6 @@ def memoize(func, *args):
dic[args] = result
return result

if __name__ == "__main__":
import doctest; doctest.testmod()

########################## LEGALESE ###############################

Expand Down
3 changes: 0 additions & 3 deletions nltk/metrics/segmentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,3 @@ def setup_module(module):
raise SkipTest("numpy is required for nltk.metrics.segmentation")


if __name__ == "__main__":
import doctest
doctest.testmod(optionflags=doctest.NORMALIZE_WHITESPACE)
3 changes: 0 additions & 3 deletions nltk/parse/bllip.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,4 @@ def setup_module(module):
raise SkipTest('doctests from nltk.parse.bllip are skipped because '
'the bllipparser module is not installed')

if __name__ == '__main__':
import doctest
doctest.testmod(optionflags=doctest.NORMALIZE_WHITESPACE | doctest.ELLIPSIS)

Loading

0 comments on commit 768d132

Please sign in to comment.