Albert-Jan Roskam wrote:
> On Thu, 1/16/14, Peter Otten <[email protected]> wrote:
>> class Foo(unittest.TestCase):
>> @unique_receipt("foo")
>> def test_t1(self, RECEIPT):
>> pass
> Very cool approach. Question, though: what would be wrong
> with the following approach:
>
>
> import unittest
>
> class Test(unittest.TestCase):
>
> receipts = {}
>
> def unique_value(self, k, v):
> assert Test.receipts.get(k) is None, "Duplicate: %s" % v
> Test.receipts[k] = v
>
> def test_a(self):
> self.unique_value("large_value", "foo")
Nothing.
--
https://mail.python.org/mailman/listinfo/python-list