> I have a convention when writing unit tests to put the target of the test
> into a class attribute, as follows:
>
> class MyTest(unittest.TestCase):
> target = mymodule.someclass
>
> def test_spam(self):
> """Test that someclass has a spam attribute."""
> self.failUnless(h
Steven D'Aprano wrote:
I have a convention when writing unit tests to put the target of the test
into a class attribute, as follows:
class MyTest(unittest.TestCase):
target = mymodule.someclass
def test_spam(self):
"""Test that someclass has a spam attribute."""
self.fa
On 20 Feb, 03:33, Steven D'Aprano wrote:
> I have a convention when writing unit tests to put the target of the test
> into a class attribute, as follows:
>
> class MyTest(unittest.TestCase):
> target = mymodule.someclass
>
> def test_spam(self):
> """Test that someclass has a spam
Steven D'Aprano writes:
> I have a convention when writing unit tests
Incidentally, you may be interested in the specific forum for testing in
Python http://lists.idyll.org/listinfo/testing-in-python> that is a
good resource for asking questions like this.
> to put the target of the test into a
this is somewhat hackish:
In [1]: def test():
...: print 'spam'
...:
...:
In [20]: class Ham():
: target = {'target': test}
: def test_eggs(self):
: self.target['target']()
:
:
In [21]: h = Ham()
In [22]: h.test_eggs()
spam
On Fr
I have a convention when writing unit tests to put the target of the test
into a class attribute, as follows:
class MyTest(unittest.TestCase):
target = mymodule.someclass
def test_spam(self):
"""Test that someclass has a spam attribute."""
self.failUnless(hasattr(self.tar