Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #64084 > unrolled thread
| Started by | Peter Otten <__peter__@web.de> |
|---|---|
| First post | 2014-01-16 15:50 +0100 |
| Last post | 2014-01-16 15:50 +0100 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: Is it possible to get string from function? Peter Otten <__peter__@web.de> - 2014-01-16 15:50 +0100
| From | Peter Otten <__peter__@web.de> |
|---|---|
| Date | 2014-01-16 15:50 +0100 |
| Subject | Re: Is it possible to get string from function? |
| Message-ID | <mailman.5588.1389883815.18130.python-list@python.org> |
Albert-Jan Roskam wrote:
> On Thu, 1/16/14, Peter Otten <__peter__@web.de> 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.
Back to top | Article view | comp.lang.python
csiph-web