Re: Iterating over test data in unit tests

2005-12-06 Thread Scott David Daniels
Ben Finney wrote: > Ben Finney <[EMAIL PROTECTED]> wrote: >> Summary: I'm looking for idioms in unit tests for factoring out >> repetitive iteration over test data. > > Thanks to those who've offered suggestions, especially those who > suggested I look at generator functions. This leads to:: Here

Re: Iterating over test data in unit tests

2005-12-05 Thread Ben Finney
Ben Finney <[EMAIL PROTECTED]> wrote: > Summary: I'm looking for idioms in unit tests for factoring out > repetitive iteration over test data. Thanks to those who've offered suggestions, especially those who suggested I look at generator functions. This leads to:: import unittest import

Re: Iterating over test data in unit tests

2005-12-05 Thread Steven Bethard
Ben Finney wrote: > Maybe I need to factor out the iteration into a generic iteration > function, taking the actual test as a function object. That way, the > dataset iterator doesn't need to know about the test function, and > vice versa. > > def iterate_test(self, test_func, test_params=

Re: Iterating over test data in unit tests

2005-12-05 Thread Bengt Richter
On Tue, 6 Dec 2005 12:19:40 +1100 (EST), Ben Finney <[EMAIL PROTECTED]> wrote: >Howdy all, > >Summary: I'm looking for idioms in unit tests for factoring out >repetitive iteration over test data. I explain my current practice, >and why it's unsatisfactory. > Does this do what you want? http:/

Re: Iterating over test data in unit tests

2005-12-05 Thread Ben Finney
Scott David Daniels <[EMAIL PROTECTED]> wrote: > Ben Finney wrote: > > Summary: I'm looking for idioms in unit tests for factoring out > > repetitive iteration over test data > > How about something like: > > > class Test_Game(unittest.TestCase): [...] >def runs(self, throws):

Re: Iterating over test data in unit tests

2005-12-05 Thread Scott David Daniels
Ben Finney wrote: > Summary: I'm looking for idioms in unit tests for factoring out > repetitive iteration over test data How about something like: > import unittest, bowling > class Test_Game(unittest.TestCase): > def setUp(self): > """ Set up test fixtures """ >