commit | author | age
|
4a7029
|
1 |
import unittest |
03a0d7
|
2 |
from pyramid.compat import is_unbound_method |
4a7029
|
3 |
|
JA |
4 |
class TestUnboundMethods(unittest.TestCase): |
|
5 |
def test_old_style_bound(self): |
|
6 |
self.assertFalse(is_unbound_method(OldStyle().run)) |
|
7 |
|
|
8 |
def test_new_style_bound(self): |
|
9 |
self.assertFalse(is_unbound_method(NewStyle().run)) |
|
10 |
|
|
11 |
def test_old_style_unbound(self): |
|
12 |
self.assertTrue(is_unbound_method(OldStyle.run)) |
|
13 |
|
|
14 |
def test_new_style_unbound(self): |
|
15 |
self.assertTrue(is_unbound_method(NewStyle.run)) |
|
16 |
|
|
17 |
def test_normal_func_unbound(self): |
03a0d7
|
18 |
def func(): return 'OK' |
4a7029
|
19 |
|
JA |
20 |
self.assertFalse(is_unbound_method(func)) |
03a0d7
|
21 |
|
JA |
22 |
class OldStyle: |
|
23 |
def run(self): return 'OK' |
|
24 |
|
|
25 |
class NewStyle(object): |
|
26 |
def run(self): return 'OK' |