Show More
@@ -97,11 +97,11 b' class TestConfigurable(TestCase):' | |||||
97 | self.assertEqual(c2.config, config) |
|
97 | self.assertEqual(c2.config, config) | |
98 | self.assertEqual(c3.config, config) |
|
98 | self.assertEqual(c3.config, config) | |
99 | # Test that copies are not made |
|
99 | # Test that copies are not made | |
100 |
self.assert |
|
100 | self.assertTrue(c1.config is config) | |
101 |
self.assert |
|
101 | self.assertTrue(c2.config is config) | |
102 |
self.assert |
|
102 | self.assertTrue(c3.config is config) | |
103 |
self.assert |
|
103 | self.assertTrue(c1.config is c2.config) | |
104 |
self.assert |
|
104 | self.assertTrue(c2.config is c3.config) | |
105 |
|
105 | |||
106 | def test_inheritance(self): |
|
106 | def test_inheritance(self): | |
107 | config = Config() |
|
107 | config = Config() |
@@ -253,8 +253,8 b' class TestConfig(TestCase):' | |||||
253 | import copy |
|
253 | import copy | |
254 | c2 = copy.deepcopy(c1) |
|
254 | c2 = copy.deepcopy(c1) | |
255 | self.assertEqual(c1, c2) |
|
255 | self.assertEqual(c1, c2) | |
256 |
self.assert |
|
256 | self.assertTrue(c1 is not c2) | |
257 |
self.assert |
|
257 | self.assertTrue(c1.Foo is not c2.Foo) | |
258 |
|
258 | |||
259 | def test_builtin(self): |
|
259 | def test_builtin(self): | |
260 | c1 = Config() |
|
260 | c1 = Config() |
@@ -9,18 +9,18 b' class TestKernelManager(TestCase):' | |||||
9 | def test_km_lifecycle(self): |
|
9 | def test_km_lifecycle(self): | |
10 | km = MultiKernelManager() |
|
10 | km = MultiKernelManager() | |
11 | kid = km.start_kernel() |
|
11 | kid = km.start_kernel() | |
12 |
self.assert |
|
12 | self.assertTrue(kid in km) | |
13 | self.assertEqual(len(km),1) |
|
13 | self.assertEqual(len(km),1) | |
14 | km.kill_kernel(kid) |
|
14 | km.kill_kernel(kid) | |
15 |
self.assert |
|
15 | self.assertTrue(not kid in km) | |
16 |
|
16 | |||
17 | kid = km.start_kernel() |
|
17 | kid = km.start_kernel() | |
18 | self.assertEqual('127.0.0.1',km.get_kernel_ip(kid)) |
|
18 | self.assertEqual('127.0.0.1',km.get_kernel_ip(kid)) | |
19 | port_dict = km.get_kernel_ports(kid) |
|
19 | port_dict = km.get_kernel_ports(kid) | |
20 |
self.assert |
|
20 | self.assertTrue('stdin_port' in port_dict) | |
21 |
self.assert |
|
21 | self.assertTrue('iopub_port' in port_dict) | |
22 |
self.assert |
|
22 | self.assertTrue('shell_port' in port_dict) | |
23 |
self.assert |
|
23 | self.assertTrue('hb_port' in port_dict) | |
24 | km.get_kernel(kid) |
|
24 | km.get_kernel(kid) | |
25 | km.kill_kernel(kid) |
|
25 | km.kill_kernel(kid) | |
26 |
|
26 |
@@ -29,12 +29,12 b' class TestKillRing(unittest.TestCase):' | |||||
29 | """ Does the generic kill ring work? |
|
29 | """ Does the generic kill ring work? | |
30 | """ |
|
30 | """ | |
31 | ring = KillRing() |
|
31 | ring = KillRing() | |
32 |
self.assert |
|
32 | self.assertTrue(ring.yank() is None) | |
33 |
self.assert |
|
33 | self.assertTrue(ring.rotate() is None) | |
34 |
|
34 | |||
35 | ring.kill('foo') |
|
35 | ring.kill('foo') | |
36 | self.assertEqual(ring.yank(), 'foo') |
|
36 | self.assertEqual(ring.yank(), 'foo') | |
37 |
self.assert |
|
37 | self.assertTrue(ring.rotate() is None) | |
38 | self.assertEqual(ring.yank(), 'foo') |
|
38 | self.assertEqual(ring.yank(), 'foo') | |
39 |
|
39 | |||
40 | ring.kill('bar') |
|
40 | ring.kill('bar') | |
@@ -42,8 +42,8 b' class TestKillRing(unittest.TestCase):' | |||||
42 | self.assertEqual(ring.rotate(), 'foo') |
|
42 | self.assertEqual(ring.rotate(), 'foo') | |
43 |
|
43 | |||
44 | ring.clear() |
|
44 | ring.clear() | |
45 |
self.assert |
|
45 | self.assertTrue(ring.yank() is None) | |
46 |
self.assert |
|
46 | self.assertTrue(ring.rotate() is None) | |
47 |
|
47 | |||
48 | def test_qt_basic(self): |
|
48 | def test_qt_basic(self): | |
49 | """ Does the Qt kill ring work? |
|
49 | """ Does the Qt kill ring work? |
@@ -55,7 +55,7 b' class RunnerTestCase(unittest.TestCase):' | |||||
55 | print(repr(ol1)) |
|
55 | print(repr(ol1)) | |
56 | print(repr(ol2)) |
|
56 | print(repr(ol2)) | |
57 | print('>>>') |
|
57 | print('>>>') | |
58 |
self.assert |
|
58 | self.assertTrue(mismatch==0,'Number of mismatched lines: %s' % | |
59 | mismatch) |
|
59 | mismatch) | |
60 |
|
60 | |||
61 | def testIPython(self): |
|
61 | def testIPython(self): |
@@ -63,7 +63,7 b' class RunnerTestCase(unittest.TestCase):' | |||||
63 | print(repr(ol1)) |
|
63 | print(repr(ol1)) | |
64 | print(repr(ol2)) |
|
64 | print(repr(ol2)) | |
65 | print('>>>') |
|
65 | print('>>>') | |
66 |
self.assert |
|
66 | self.assertTrue(mismatch==0,'Number of mismatched lines: %s' % | |
67 | mismatch) |
|
67 | mismatch) | |
68 |
|
68 | |||
69 | @decorators.skipif_not_matplotlib |
|
69 | @decorators.skipif_not_matplotlib |
@@ -50,23 +50,23 b' class TestClient(ClusterTestCase):' | |||||
50 | self.assertEqual(v.targets, targets) |
|
50 | self.assertEqual(v.targets, targets) | |
51 | t = self.client.ids[2] |
|
51 | t = self.client.ids[2] | |
52 | v = self.client[t] |
|
52 | v = self.client[t] | |
53 |
self.assert |
|
53 | self.assertTrue(isinstance(v, DirectView)) | |
54 | self.assertEqual(v.targets, t) |
|
54 | self.assertEqual(v.targets, t) | |
55 | t = self.client.ids[2:4] |
|
55 | t = self.client.ids[2:4] | |
56 | v = self.client[t] |
|
56 | v = self.client[t] | |
57 |
self.assert |
|
57 | self.assertTrue(isinstance(v, DirectView)) | |
58 | self.assertEqual(v.targets, t) |
|
58 | self.assertEqual(v.targets, t) | |
59 | v = self.client[::2] |
|
59 | v = self.client[::2] | |
60 |
self.assert |
|
60 | self.assertTrue(isinstance(v, DirectView)) | |
61 | self.assertEqual(v.targets, targets[::2]) |
|
61 | self.assertEqual(v.targets, targets[::2]) | |
62 | v = self.client[1::3] |
|
62 | v = self.client[1::3] | |
63 |
self.assert |
|
63 | self.assertTrue(isinstance(v, DirectView)) | |
64 | self.assertEqual(v.targets, targets[1::3]) |
|
64 | self.assertEqual(v.targets, targets[1::3]) | |
65 | v = self.client[:-3] |
|
65 | v = self.client[:-3] | |
66 |
self.assert |
|
66 | self.assertTrue(isinstance(v, DirectView)) | |
67 | self.assertEqual(v.targets, targets[:-3]) |
|
67 | self.assertEqual(v.targets, targets[:-3]) | |
68 | v = self.client[-1] |
|
68 | v = self.client[-1] | |
69 |
self.assert |
|
69 | self.assertTrue(isinstance(v, DirectView)) | |
70 | self.assertEqual(v.targets, targets[-1]) |
|
70 | self.assertEqual(v.targets, targets[-1]) | |
71 | self.assertRaises(TypeError, lambda : self.client[None]) |
|
71 | self.assertRaises(TypeError, lambda : self.client[None]) | |
72 |
|
72 |
@@ -117,11 +117,11 b' class NotificationTests(unittest.TestCase):' | |||||
117 | for i in xrange(10): |
|
117 | for i in xrange(10): | |
118 | Observer('TYPE', None, center=shared_center) |
|
118 | Observer('TYPE', None, center=shared_center) | |
119 |
|
119 | |||
120 |
self.assert |
|
120 | self.assertTrue(len(shared_center.observers[('TYPE',None)]) >= 10, | |
121 | "observers registered") |
|
121 | "observers registered") | |
122 |
|
122 | |||
123 | shared_center.remove_all_observers() |
|
123 | shared_center.remove_all_observers() | |
124 |
self.assert |
|
124 | self.assertTrue(len(shared_center.observers) == 0, "observers removed") | |
125 |
|
125 | |||
126 | def test_any_sender(self): |
|
126 | def test_any_sender(self): | |
127 | expected_ntype = "EXPECTED_TYPE" |
|
127 | expected_ntype = "EXPECTED_TYPE" |
@@ -237,9 +237,9 b' class TestHasTraitsNotify(TestCase):' | |||||
237 | a.b = 0.0 |
|
237 | a.b = 0.0 | |
238 | self.assertEqual(len(self._notify1),0) |
|
238 | self.assertEqual(len(self._notify1),0) | |
239 | a.a = 10 |
|
239 | a.a = 10 | |
240 |
self.assert |
|
240 | self.assertTrue(('a',0,10) in self._notify1) | |
241 | a.b = 10.0 |
|
241 | a.b = 10.0 | |
242 |
self.assert |
|
242 | self.assertTrue(('b',0.0,10.0) in self._notify1) | |
243 | self.assertRaises(TraitError,setattr,a,'a','bad string') |
|
243 | self.assertRaises(TraitError,setattr,a,'a','bad string') | |
244 | self.assertRaises(TraitError,setattr,a,'b','bad string') |
|
244 | self.assertRaises(TraitError,setattr,a,'b','bad string') | |
245 | self._notify1 = [] |
|
245 | self._notify1 = [] | |
@@ -259,7 +259,7 b' class TestHasTraitsNotify(TestCase):' | |||||
259 | a.a = 0 |
|
259 | a.a = 0 | |
260 | self.assertEqual(len(self._notify1),0) |
|
260 | self.assertEqual(len(self._notify1),0) | |
261 | a.a = 10 |
|
261 | a.a = 10 | |
262 |
self.assert |
|
262 | self.assertTrue(('a',0,10) in self._notify1) | |
263 | self.assertRaises(TraitError,setattr,a,'a','bad string') |
|
263 | self.assertRaises(TraitError,setattr,a,'a','bad string') | |
264 |
|
264 | |||
265 | def test_subclass(self): |
|
265 | def test_subclass(self): | |
@@ -295,8 +295,8 b' class TestHasTraitsNotify(TestCase):' | |||||
295 | self.assertEqual(len(self._notify2),0) |
|
295 | self.assertEqual(len(self._notify2),0) | |
296 | b.a = 10 |
|
296 | b.a = 10 | |
297 | b.b = 10.0 |
|
297 | b.b = 10.0 | |
298 |
self.assert |
|
298 | self.assertTrue(('a',0,10) in self._notify1) | |
299 |
self.assert |
|
299 | self.assertTrue(('b',0.0,10.0) in self._notify2) | |
300 |
|
300 | |||
301 | def test_static_notify(self): |
|
301 | def test_static_notify(self): | |
302 |
|
302 | |||
@@ -311,7 +311,7 b' class TestHasTraitsNotify(TestCase):' | |||||
311 | # This is broken!!! |
|
311 | # This is broken!!! | |
312 | self.assertEqual(len(a._notify1),0) |
|
312 | self.assertEqual(len(a._notify1),0) | |
313 | a.a = 10 |
|
313 | a.a = 10 | |
314 |
self.assert |
|
314 | self.assertTrue(('a',0,10) in a._notify1) | |
315 |
|
315 | |||
316 | class B(A): |
|
316 | class B(A): | |
317 | b = Float |
|
317 | b = Float | |
@@ -322,8 +322,8 b' class TestHasTraitsNotify(TestCase):' | |||||
322 | b = B() |
|
322 | b = B() | |
323 | b.a = 10 |
|
323 | b.a = 10 | |
324 | b.b = 10.0 |
|
324 | b.b = 10.0 | |
325 |
self.assert |
|
325 | self.assertTrue(('a',0,10) in b._notify1) | |
326 |
self.assert |
|
326 | self.assertTrue(('b',0.0,10.0) in b._notify2) | |
327 |
|
327 | |||
328 | def test_notify_args(self): |
|
328 | def test_notify_args(self): | |
329 |
|
329 | |||
@@ -504,11 +504,11 b' class TestInstance(TestCase):' | |||||
504 | inst = Instance(Foo) |
|
504 | inst = Instance(Foo) | |
505 |
|
505 | |||
506 | a = A() |
|
506 | a = A() | |
507 |
self.assert |
|
507 | self.assertTrue(a.inst is None) | |
508 | a.inst = Foo() |
|
508 | a.inst = Foo() | |
509 |
self.assert |
|
509 | self.assertTrue(isinstance(a.inst, Foo)) | |
510 | a.inst = Bar() |
|
510 | a.inst = Bar() | |
511 |
self.assert |
|
511 | self.assertTrue(isinstance(a.inst, Foo)) | |
512 | self.assertRaises(TraitError, setattr, a, 'inst', Foo) |
|
512 | self.assertRaises(TraitError, setattr, a, 'inst', Foo) | |
513 | self.assertRaises(TraitError, setattr, a, 'inst', Bar) |
|
513 | self.assertRaises(TraitError, setattr, a, 'inst', Bar) | |
514 | self.assertRaises(TraitError, setattr, a, 'inst', Bah()) |
|
514 | self.assertRaises(TraitError, setattr, a, 'inst', Bah()) | |
@@ -520,7 +520,7 b' class TestInstance(TestCase):' | |||||
520 |
|
520 | |||
521 | a = A() |
|
521 | a = A() | |
522 | b = A() |
|
522 | b = A() | |
523 |
self.assert |
|
523 | self.assertTrue(a.inst is not b.inst) | |
524 |
|
524 | |||
525 | def test_args_kw(self): |
|
525 | def test_args_kw(self): | |
526 | class Foo(object): |
|
526 | class Foo(object): | |
@@ -544,7 +544,7 b' class TestInstance(TestCase):' | |||||
544 | class C(HasTraits): |
|
544 | class C(HasTraits): | |
545 | inst = Instance(Foo) |
|
545 | inst = Instance(Foo) | |
546 | c = C() |
|
546 | c = C() | |
547 |
self.assert |
|
547 | self.assertTrue(c.inst is None) | |
548 |
|
548 | |||
549 | def test_bad_default(self): |
|
549 | def test_bad_default(self): | |
550 | class Foo(object): pass |
|
550 | class Foo(object): pass | |
@@ -583,7 +583,7 b' class TestThis(TestCase):' | |||||
583 |
|
583 | |||
584 | f = Foo() |
|
584 | f = Foo() | |
585 | f.this = Foo() |
|
585 | f.this = Foo() | |
586 |
self.assert |
|
586 | self.assertTrue(isinstance(f.this, Foo)) | |
587 |
|
587 | |||
588 | def test_subclass(self): |
|
588 | def test_subclass(self): | |
589 | class Foo(HasTraits): |
|
589 | class Foo(HasTraits): |
General Comments 0
You need to be logged in to leave comments.
Login now