Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alert the user if they are using an unbound class methods to add_view #1498

Merged
merged 5 commits into from
Feb 8, 2015
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Clean up compat tests
  • Loading branch information
sontek committed Dec 27, 2014
commit 03a0d79306b2846313df1983a721d5cccf4ec3ce
36 changes: 8 additions & 28 deletions pyramid/tests/test_compat.py
Original file line number Diff line number Diff line change
@@ -1,46 +1,26 @@
import unittest
from pyramid.compat import is_unbound_method

class TestUnboundMethods(unittest.TestCase):
def test_old_style_bound(self):
from pyramid.compat import is_unbound_method

class OldStyle:
def run(self):
return 'OK'

self.assertFalse(is_unbound_method(OldStyle().run))

def test_new_style_bound(self):
from pyramid.compat import is_unbound_method

class NewStyle(object):
def run(self):
return 'OK'

self.assertFalse(is_unbound_method(NewStyle().run))

def test_old_style_unbound(self):
from pyramid.compat import is_unbound_method

class OldStyle:
def run(self):
return 'OK'

self.assertTrue(is_unbound_method(OldStyle.run))

def test_new_style_unbound(self):
from pyramid.compat import is_unbound_method

class NewStyle(object):
def run(self):
return 'OK'

self.assertTrue(is_unbound_method(NewStyle.run))

def test_normal_func_unbound(self):
from pyramid.compat import is_unbound_method

def func():
return 'OK'
def func(): return 'OK'

self.assertFalse(is_unbound_method(func))

class OldStyle:
def run(self): return 'OK'

class NewStyle(object):
def run(self): return 'OK'