I think that the best approach I saw to this was in the Eclipse java ide... You can basically go on the declaration of

self.obj = player.Player('Fred the Adventurer')

press Ctrl+1 and it adds a suggestion to create the class Player.

Then go to

assert self.obj.name == 'Fred the Adventurer'

press Ctrl+1 and it adds suggestion: Declare field name in class Player... and so on for methods... (true, you still have to go and press some Ctrl+1s, but that should be fairly easy, especially if you had some hints on what is missing... Python has a very dynamic nature, but most of it can still be done...

I think that most Python IDEs are still not in the same level, but some day they might get there...
Being the maintaner of PyDev (http://pydev.sf.net), I think it will get there someday, true, lots of work to make it happen, right now only few things in Ctrl+1 are available like that (still, some already are)... and that's the way things work... nothing's always perfect (but at least they evolve).


Regards,

Fabio


Peter Maas wrote:

Edvard Majakari schrieb:

Greetings, fellow Pythonistas!

I'm about to create three modules. As an avid TDD fan I'd like to create
typical 'use-cases' for each of these modules. One of them is rather large,
and I wondered if it would be easy enough to create a code skeleton out of
unit test module.


I think this is too difficult, because there are many ways to write
code (even skeletons) for a use case. An easier approach would
be to write the skeleton manually, embed the test cases in the doc
strings and generate the test code from the doc strings. If I
remember correctly IBM has published something to generate unit
tests from code. Python has a doctest module to support testing
derived from doc strings. This can be combined with unit tests.

> The problem can be solved more easily if you design the module

skeleton first, then the tests and then the logic for the skeleton
- you would be creating tests before the code, but many people

> wouldn't regard it as TDD then.

You shouldn't care if your approach works for you.



--
Fabio Zadrozny
------------------------------------------------------
Software Developer
ESSS - Engineering Simulation and Scientific Software
www.esss.com.br

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to