concise code (beginner)

Michele Simionato michele.simionato at gmail.com
Fri Sep 7 02:01:30 EDT 2007


On Sep 6, 7:44 am, "bambam" <da... at asdf.asdf> wrote:
> First, thank you.
>
> All of the suggestions match what we want to do much better
> than what we are doing. We have a script, written in python,
> which is doing testing. But the python script doesn't look anything
> like the test script, because the python script is written in python,
> and the test script is a series of instrument command macros.
>
> By putting the script sequence into a collection that is separate
> from the python code, we will get script list that general engineering
> will find much easier to understand:
>
> def script(self)
>     def a0010(): global self; self.power_on([self.dev]);
>     def a0020(): global self; self.dev.addLog([self.name, ' started']);
>     def a0030(): global self; self.resetMinuteReg([self.dev]);
>     def a0040(): global self; self.disablePLmessages([self.dev]);
>     def a0050(): global self; self.dev.testH.writePLram((PL.BCAL12<<8));

Look at generative tests in py.test or nose: they are a much
better solution for what you are doing.

            Michele Simionato




More information about the Python-list mailing list