Fix Channel constructor and add simple test; closes #32
This commit is contained in:
parent
4f50707b82
commit
502266f115
|
@ -308,8 +308,8 @@ class Receiver(object):
|
||||||
|
|
||||||
|
|
||||||
class Channel(Sender, Receiver):
|
class Channel(Sender, Receiver):
|
||||||
def __init__(self, router, context, dst_id, handle=None):
|
def __init__(self, router, context, dst_handle, handle=None):
|
||||||
Sender.__init_(self, context, dst_id)
|
Sender.__init__(self, context, dst_handle)
|
||||||
Receiver.__init__(self, router, handle)
|
Receiver.__init__(self, router, handle)
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
import unittest
|
||||||
|
|
||||||
|
import mitogen.core
|
||||||
|
import testlib
|
||||||
|
|
||||||
|
|
||||||
|
class ConstructorTest(testlib.RouterMixin, unittest.TestCase):
|
||||||
|
def test_constructor(self):
|
||||||
|
# issue 32
|
||||||
|
l1 = self.router.local()
|
||||||
|
chan = mitogen.core.Channel(self.router, l1, 123)
|
||||||
|
assert chan.router == self.router
|
||||||
|
assert chan.context == l1
|
||||||
|
assert chan.dst_handle == 123
|
||||||
|
assert chan.handle is not None
|
||||||
|
assert chan.handle > 0
|
Loading…
Reference in New Issue