python - Embedding test code or data within doctest strings -


I have several types of paragraphs in a file sharing test data and / or function. Is this any way to find out in an external file or without a code to check the file?

Update

  "" "This is the docstring module 'fish'. I have found that I can access the examination module from within the exam and make changes in it. For example, for example, import fish & gt; & gt; & gt; fishdata = {1: 'red', 2: 'blue'} "" def jeff (): " "Modifications made in the module will continue in subsequent trials: & gt; & Gt; & Gt; Import Fish & gt; & Gt; & Gt; Fish. [1] "Red" "PAF DEF Cess ():" "" Although the Doctest Documents claim that "Every time the Donstest receives a dosstring for testing, it uses the shallow transcript of MK Globals "Modifications are not imported by an Embassy in the context of the DocString module: & gt; & Gt; Data traceback (most recent call last): ... error in name: name 'data' is not defined "" ""  

then

I think that doctest Once you copy the module, and then copy the copy per copy to the dotstring?

In any case, the module in each dosstring seems to be importable if it is odd. / P>

I would like to use a different namespace for this , Which is to avoid misleading actual module data, which will probably be imported in later trials without documentation.

It has happened to me that it (theoretical It is possible to create a module dynamically to control this naming place, though so far I have not got any direction about how to do some time ago. Oi would also like to publicize information is welcome! (Great question)

name Dokstring any position since I direct changes location. So my basic question still stands as a qualifier.

This is something that causes people to get rid of the teachings: As your test complexity Grow in, you need the actual programming tool to be able to engineer your program, as you would engineer your product code.

I do not think there is no way to include in addition to defining them in their product code and in addition to using them in docortes and to include shared data or tasks.

You will need to use the actual code to define some of your testing infrastructure. If you like duties, then you can use that structure with your own formulas.


Comments