This file contains hidden or 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
| class A(object): | |
| class_attribute = 1 | |
| def __init__(self): | |
| self.instance_attribute = 2 | |
| class B(A): | |
| def test1(self): | |
| print super(B, self).class_attribute | |
| def test2(self): |
This file contains hidden or 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
| import nose.core | |
| import unittest | |
| runner = nose.core.TextTestRunner() | |
| # runner = unittest.TextTestRunner() # Does not work either | |
| programm = nose.core.TestProgram(defaultTest='.', testRunner=runner, | |
| argv=['nosetests'], exit=False) | |
| # programm = nose.core.TestProgram(defaultTest='.', # This works | |
| # argv=['nosetests'], exit=False) | |
| print "Hello World !" |
This file contains hidden or 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
| # Come from excellent http://stefan.sofa-rockers.org/2012/02/01/designing-and-testing-pyzmq-applications-part-1/ | |
| def stream(context, loop, sock_type, addr, bind, callback=None, subscribe=b'', | |
| random=False): | |
| """ | |
| Creates a :class:`~zmq.eventloop.zmqstream.ZMQStream`. | |
| :param sock_type: The ØMQ socket type (e.g. ``zmq.REQ``) | |
| :param addr: Address to bind or connect to formatted as *host:port*, | |
| *(host, port)* or *host* (bind to random port). | |
| If *bind* is ``True``, *host* may be: |
This file contains hidden or 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
| def __setattr__(self, index, value): | |
| # Hack for properties setter | |
| if hasattr(getattr(self.__class__, index, None), '__get__'): | |
| return object.__setattr__(self, index, value) |
This file contains hidden or 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
| import unittest | |
| class ListApiSet(object): | |
| def __init__(self): | |
| self.container = set() | |
| def extend(self, value): | |
| self.container.update(value) | |
| return self.container |
This file contains hidden or 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
| import unittest | |
| from poc import TemplateTestCase, Call, template | |
| def support_http_method(method): | |
| if method in ('POST', 'GETT'): | |
| return True | |
| else: | |
| return False | |
| class SupportHttpMethodTestCase(unittest.TestCase): |
This file contains hidden or 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
| import unittest | |
| from poc import TemplateTestCase, Call, template | |
| def support_http_method(method): | |
| if method in ('POST', 'GET'): | |
| return True | |
| else: | |
| return False | |
| class SupportHttpMethodTestCase(unittest.TestCase): |
This file contains hidden or 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
| def support_http_method(method): | |
| if method in ('POST', 'GETT'): | |
| return True | |
| else: | |
| return False | |
| def test_support(): | |
| expected_values = { | |
| 'POST': True, | |
| 'GET': True, |
This file contains hidden or 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
| def support_http_method(method): | |
| if method in ('POST', 'GET'): | |
| return True | |
| else: | |
| return False | |
| def test_support(): | |
| expected_values = { | |
| 'POST': True, | |
| 'GET': True, |
This file contains hidden or 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
| import unittest | |
| def support_http_method(method): | |
| if method in ('POST', 'GETT'): | |
| return True | |
| else: | |
| return False | |
| class SupportHttpMethodTestCase(unittest.TestCase): |