Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(71)

Side by Side Diff: third_party/twisted_8_1/twisted/test/test_roots.py

Issue 12261012: Remove third_party/twisted_8_1 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/build
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 # Copyright (c) 2001-2004 Twisted Matrix Laboratories.
2 # See LICENSE for details.
3
4 from twisted.trial import unittest
5 from twisted.python import roots
6 import types
7
8 class RootsTest(unittest.TestCase):
9
10 def testExceptions(self):
11 request = roots.Request()
12 try:
13 request.write("blah")
14 except NotImplementedError:
15 pass
16 else:
17 self.fail()
18 try:
19 request.finish()
20 except NotImplementedError:
21 pass
22 else:
23 self.fail()
24
25 def testCollection(self):
26 collection = roots.Collection()
27 collection.putEntity("x", 'test')
28 self.failUnlessEqual(collection.getStaticEntity("x"),
29 'test')
30 collection.delEntity("x")
31 self.failUnlessEqual(collection.getStaticEntity('x'),
32 None)
33 try:
34 collection.storeEntity("x", None)
35 except NotImplementedError:
36 pass
37 else:
38 self.fail()
39 try:
40 collection.removeEntity("x", None)
41 except NotImplementedError:
42 pass
43 else:
44 self.fail()
45
46 def testConstrained(self):
47 class const(roots.Constrained):
48 def nameConstraint(self, name):
49 return (name == 'x')
50 c = const()
51 self.failUnlessEqual(c.putEntity('x', 'test'), None)
52 self.failUnlessRaises(roots.ConstraintViolation,
53 c.putEntity, 'y', 'test')
54
55
56 def testHomogenous(self):
57 h = roots.Homogenous()
58 h.entityType = types.IntType
59 h.putEntity('a', 1)
60 self.failUnlessEqual(h.getStaticEntity('a'),1 )
61 self.failUnlessRaises(roots.ConstraintViolation,
62 h.putEntity, 'x', 'y')
63
OLDNEW
« no previous file with comments | « third_party/twisted_8_1/twisted/test/test_reflector.py ('k') | third_party/twisted_8_1/twisted/test/test_shortcut.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698