new proposal for doctests

This commit is contained in:
Henning Peters 2015-09-25 11:54:32 +02:00
parent e08eca837c
commit 22d1112031
4 changed files with 6 additions and 26 deletions

View File

@ -6,13 +6,16 @@ mixin example(name)
+example("Load resources and process text") +example("Load resources and process text")
include:doctest_all ../../../tests/test_load_resources_and_process_text.txt pre.language-python: code
include ../../code/home.load_resources_and_process_text
+example("Get tokens and sentences") +example("Get tokens and sentences")
include:doctest ../../../tests/test_get_tokens_and_sentences.txt pre.language-python: code
include ../../code/home.get_tokens_and_sentences
+example("Use integer IDs for any string") +example("Use integer IDs for any string")
include:doctest ../../../tests/test_use_interger_ids_for_any_strings.txt pre.language-python: code
include ../../code/home.use_integer_ids_for_any_strings
+example("Get and set string views and flags") +example("Get and set string views and flags")
pre.language-python: code pre.language-python: code

View File

@ -1,8 +0,0 @@
>>> from spacy.en import English ###
>>> nlp = English() ###
>>> doc = nlp(u'Hello, world. Here are two sentences.') ###
>>>
>>> token = doc[0]
>>> sentence = doc.sents.next()
>>> assert token is sentence[0]
>>> assert sentence.text == 'Hello, world.'

View File

@ -1,5 +0,0 @@
>>> from spacy.en import English
>>> nlp = English()
>>> doc = nlp(u'Hello, world. Here are two sentences.')
>>> print([s.string for s in doc.sents])
[u'Hello, world. ', u'Here are two sentences.']

View File

@ -1,10 +0,0 @@
>>> from spacy.en import English ###
>>> nlp = English() ###
>>> doc = nlp(u'Hello, world. Here are two sentences.') ###
>>> token = doc[0] ###
>>>
>>> hello_id = nlp.vocab.strings['Hello']
>>> hello_str = nlp.vocab.strings[hello_id]
>>>
>>> assert token.orth == hello_id == 469755
>>> assert token.orth_ == hello_str == 'Hello'