1
# Copyright (c) 2009 Twisted Matrix Laboratories.
2
# See LICENSE for details.
5
Direct unit tests for L{twisted.trial.unittest.TestCase}.
8
from twisted.trial.unittest import TestCase
11
class TestCaseTests(TestCase):
15
class MyTestCase(TestCase):
17
Some test methods which can be used to test behaviors of
25
Create a couple instances of C{MyTestCase}, each for the same test
26
method, to be used in the test methods of this class.
28
self.first = self.MyTestCase('test_1')
29
self.second = self.MyTestCase('test_1')
32
def test_equality(self):
34
In order for one test method to be runnable twice, two TestCase
35
instances with the same test method name must not compare as equal.
37
self.assertTrue(self.first == self.first)
38
self.assertTrue(self.first != self.second)
39
self.assertFalse(self.first == self.second)
42
def test_hashability(self):
44
In order for one test method to be runnable twice, two TestCase
45
instances with the same test method name should not have the same
49
container[self.first] = None
50
container[self.second] = None
51
self.assertEquals(len(container), 2)