[Tutor] Newbie & Unittest ...

Damon Timm damontimm at gmail.com
Thu May 6 20:31:00 CEST 2010


Sorry for the multiple posts ... I'll be quiet for a while until I
find a real answer!

What I wrote below doesn't actually work -- it appears to work because
all the functions have different names but they all reference a single
function ... I should have looked more closely at my initial output...
I'm going to have to look into why that is.  I need a way to make each
function unique ...

On Thu, May 6, 2010 at 2:04 PM, Damon Timm <damontimm at gmail.com> wrote:
> class TestFileTags(unittest.TestCase):
>    pass
>
> for test_name, file, key, value in list_of_tests:
>    def test_func(self):
>        self.assertEqual(file.tags[key], value)
>
>    setattr(TestFileTags, test_name, test_func)


More information about the Tutor mailing list