Show More
@@ -490,4 +490,18 b' class TestView(ClusterTestCase):' | |||
|
490 | 490 | result = v.apply_sync(rf, 5) |
|
491 | 491 | expected = [ 5*id for id in self.client.ids ] |
|
492 | 492 | self.assertEquals(result, expected) |
|
493 | ||
|
494 | def test_eval_reference(self): | |
|
495 | v = self.client[self.client.ids[0]] | |
|
496 | v['g'] = range(5) | |
|
497 | rg = pmod.Reference('g[0]') | |
|
498 | echo = lambda x:x | |
|
499 | self.assertEquals(v.apply_sync(echo, rg), 0) | |
|
500 | ||
|
501 | def test_reference_nameerror(self): | |
|
502 | v = self.client[self.client.ids[0]] | |
|
503 | r = pmod.Reference('elvis_has_left') | |
|
504 | echo = lambda x:x | |
|
505 | self.assertRaisesRemote(NameError, v.apply_sync, echo, r) | |
|
506 | ||
|
493 | 507 |
@@ -54,10 +54,8 b' class Reference(CannedObject):' | |||
|
54 | 54 | def getObject(self, g=None): |
|
55 | 55 | if g is None: |
|
56 | 56 | g = globals() |
|
57 |
|
|
|
58 |
|
|
|
59 | except KeyError: | |
|
60 | raise NameError("name %r is not defined"%self.name) | |
|
57 | ||
|
58 | return eval(self.name, g) | |
|
61 | 59 | |
|
62 | 60 | |
|
63 | 61 | class CannedFunction(CannedObject): |
General Comments 0
You need to be logged in to leave comments.
Login now