Re: sharing data across Examples docstrings

2022-01-14 Thread Martin Di Paola
Hello, I understand that you want to share data across examples (docstrings) because you are running doctest to validate them (and test). The doctest implementation evaluates each docstring separately without sharing the context so the short answer is "no". This is a limitation of doctest

Re: sharing data across Examples docstrings

2022-01-11 Thread Sebastian Luque
On Wed, 12 Jan 2022 09:28:16 +1100, Cameron Simpson wrote: [...] > Personally I'd be inclined to put long identical examples in the class > docstring instead of the method, but that may not be appropriate. Good point, and perhaps it's best to put a comprehensive example in the class docstring,

Re: sharing data across Examples docstrings

2022-01-11 Thread Cameron Simpson
On 11Jan2022 16:09, Sebastian Luque wrote: >I am searching for a mechanism for sharing data across Examples >sections >in docstrings within a class. For instance: > >class Foo: > >def foo(self): >"""Method foo title > >The example generating data below may be much more

Re: sharing data across Examples docstrings

2022-01-11 Thread Chris Angelico
On Wed, Jan 12, 2022 at 9:11 AM Sebastian Luque wrote: > > Hello, > > I am searching for a mechanism for sharing data across Examples sections > in docstrings within a class. For instance: This seems like trying to cram too much information into the docstring, but oh well... do what you will.

sharing data across Examples docstrings

2022-01-11 Thread Sebastian Luque
Hello, I am searching for a mechanism for sharing data across Examples sections in docstrings within a class. For instance: class Foo: def foo(self): """Method foo title The example generating data below may be much more laborious. Examples