This repository has been archived by the owner on Jun 4, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed type of some __copy__ methods to correctly deal with possible s…
…ubclassing (Proxy). Tweaked handling of methods on the async proxy adapter. This also fixed the problems with current_context on async proxy calls. Fixes #90
- Loading branch information
Showing
4 changed files
with
44 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -249,6 +249,13 @@ def testUriCopy(self): | |
self.assertEqual(p1.object, p3.object) | ||
self.assertEqual(p1, p3) | ||
|
||
def testUriSubclassCopy(self): | ||
class SubURI(Pyro4.core.URI): | ||
pass | ||
u = SubURI("PYRO:12345@hostname:9999") | ||
u2 = copy.copy(u) | ||
self.assertIsInstance(u2, SubURI) | ||
|
||
def testUriEqual(self): | ||
p1 = Pyro4.core.URI("PYRO:[email protected]:9999") | ||
p2 = Pyro4.core.URI("PYRO:[email protected]:9999") | ||
|
@@ -305,6 +312,25 @@ def testProxyCopy(self): | |
self.assertEqual(p1._pyroHmacKey, p2._pyroHmacKey) | ||
self.assertEqual(p1._pyroHandshake, p2._pyroHandshake) | ||
|
||
def testProxySubclassCopy(self): | ||
class ProxySub(Pyro4.core.Proxy): | ||
pass | ||
p = ProxySub("PYRO:12345@hostname:9999") | ||
p2 = copy.copy(p) | ||
self.assertIsInstance(p2, ProxySub) | ||
|
||
def testAsyncProxyAdapterCopy(self): | ||
proxy = Pyro4.core.Proxy("PYRO:12345@hostname:9999") | ||
asyncproxy = proxy._pyroAsync() | ||
p2 = copy.copy(asyncproxy) | ||
self.assertIsInstance(p2, Pyro4.core._AsyncProxyAdapter) | ||
|
||
def testBatchProxyAdapterCopy(self): | ||
proxy = Pyro4.core.Proxy("PYRO:12345@hostname:9999") | ||
batchproxy = proxy._pyroBatch() | ||
p2 = copy.copy(batchproxy) | ||
self.assertIsInstance(p2, Pyro4.core._BatchProxyAdapter) | ||
|
||
def testProxyOffline(self): | ||
# only offline stuff here. | ||
# online stuff needs a running daemon, so we do that in another test, to keep this one simple | ||
|