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

Side by Side Diff: third_party/twisted_8_1/twisted/conch/test/test_mixin.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 # -*- twisted.conch.test.test_mixin -*-
2 # Copyright (c) 2001-2004 Twisted Matrix Laboratories.
3 # See LICENSE for details.
4
5 import time
6
7 from twisted.internet import reactor, protocol
8
9 from twisted.trial import unittest
10 from twisted.test.proto_helpers import StringTransport
11
12 from twisted.conch import mixin
13
14
15 class TestBufferingProto(mixin.BufferingMixin):
16 scheduled = False
17 rescheduled = 0
18 def schedule(self):
19 self.scheduled = True
20 return object()
21
22 def reschedule(self, token):
23 self.rescheduled += 1
24
25
26
27 class BufferingTest(unittest.TestCase):
28 def testBuffering(self):
29 p = TestBufferingProto()
30 t = p.transport = StringTransport()
31
32 self.failIf(p.scheduled)
33
34 L = ['foo', 'bar', 'baz', 'quux']
35
36 p.write('foo')
37 self.failUnless(p.scheduled)
38 self.failIf(p.rescheduled)
39
40 for s in L:
41 n = p.rescheduled
42 p.write(s)
43 self.assertEquals(p.rescheduled, n + 1)
44 self.assertEquals(t.value(), '')
45
46 p.flush()
47 self.assertEquals(t.value(), 'foo' + ''.join(L))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698