Terry Reedy writes:
> The temptation to write unfactored duplicate code like this is a
> negative of unittest.
I don't see that it's especially attributable to the ‘unittest’ module.
It's a common problem to be solved, and solutions are available.
> The question is whether get_filenames gets th
On 10/16/2010 6:05 PM, Ben Finney wrote:
jimgardener writes:
class FileNamesTest(unittest.TestCase):
def setUp(self):
self.dirname='/home/me/data'
def test_get_filenames(self):
innerstr='tom'
matching_names=get_filenames(self.dirname,innerstr)
se
Ben Finney writes:
> Yes, that's by design. Each function in a TestCase subclass is a test
> case […]
Poorly described. Try this instead: Each test case in a TestCase
subclass must be a separate function, whose name starts with ‘test’.
Or you could see what the documentation says; it may descri
jimgardener writes:
> class FileNamesTest(unittest.TestCase):
> def setUp(self):
> self.dirname='/home/me/data'
>
> def test_get_filenames(self):
> innerstr='tom'
> matching_names=get_filenames(self.dirname,innerstr)
> self.assertEquals(1,len(matching_name
thanks Peter
that was good advice
jim
On Oct 16, 1:44 pm, Peter Otten <__pete...@web.de> wrote:
> Keep it simple ;)
--
http://mail.python.org/mailman/listinfo/python-list
jimgardener wrote:
> I was testing a function using unittest.
>
> def get_filenames(dirname,innerstring):
>
> return filenames_containing_innerstring
> class FileNamesTest(unittest.TestCase):
> def setUp(self):
> self.dirname='/home/me/data'
> when I run the unittest,