Skip to content
Snippets Groups Projects
Commit 54b9dee3 authored by Piotr Maślanka's avatar Piotr Maślanka
Browse files

tests for Proxy

parent d501a6f2
No related branches found
No related tags found
No related merge requests found
...@@ -79,8 +79,16 @@ class TestProxy(unittest.TestCase): ...@@ -79,8 +79,16 @@ class TestProxy(unittest.TestCase):
def __init__(self, test): def __init__(self, test):
self.test = test self.test = test
def __matmul__(self, other):
return 2
def __rmatmul__(self, other):
return 3
a = Proxy(MyClass(2)) a = Proxy(MyClass(2))
self.assertEqual(a.test, 2) self.assertEqual(a.test, 2)
self.assertEqual(a @ 2, 2)
self.assertEqual(2 @ a, 3)
self.assertIn('test', dir(a)) self.assertIn('test', dir(a))
del a.test del a.test
self.assertRaises(AttributeError, lambda: a.test) self.assertRaises(AttributeError, lambda: a.test)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment