!C99Shell v. 2.0 [PHP 7 Update] [25.02.2019]!

Software: Apache/2.4.18 (Ubuntu). PHP/7.0.33-0ubuntu0.16.04.16 

uname -a: Linux digifus 3.13.0-57-generic #95-Ubuntu SMP Fri Jun 19 09:28:15 UTC 2015 x86_64 

uid=33(www-data) gid=33(www-data) groups=33(www-data) 

Safe-mode: OFF (not secure)

/usr/lib/python3/dist-packages/zope/hookable/tests/   drwxr-xr-x
Free 9.4 GB of 29.4 GB (31.98%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     test_hookable.py (3.3 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
##############################################################################
#
# Copyright (c) 2003 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Test the hookable support Extension
"""
import unittest

class PyHookableTests(unittest.TestCase):

    def _callFUT(self, *args, **kw):
        from zope.hookable import _py_hookable
        return _py_hookable(*args, **kw)

    def test_before_hook(self):
        def _foo():
            return 'FOO'
        hooked = self._callFUT(_foo)
        self.assertTrue(hooked.original is _foo)
        self.assertTrue(hooked.implementation is _foo)
        self.assertEqual(hooked(), 'FOO')

    def test_after_hook(self):
        def _foo():
            return 'FOO'
        def _bar():
            return 'BAR'
        hooked = self._callFUT(_foo)
        old = hooked.sethook(_bar)
        self.assertTrue(old is _foo)
        self.assertTrue(hooked.original is _foo)
        self.assertTrue(hooked.implementation is _bar)
        self.assertEqual(hooked(), 'BAR')

    def test_after_hook_and_reset(self):
        def _foo():
            return 'FOO'
        def _bar():
            return 'BAR'
        hooked = self._callFUT(_foo)
        old = hooked.sethook(_bar)
        hooked.reset()
        self.assertTrue(old is _foo)
        self.assertTrue(hooked.original is _foo)
        self.assertTrue(hooked.implementation is _foo)
        self.assertEqual(hooked(), 'FOO')

    def test_original_cannot_be_deleted(self):
        def _foo():
            return 'FOO'
        hooked = self._callFUT(_foo)
        def _try():
            del hooked.original
        self.assertRaises((TypeError, AttributeError), _try)

    def test_implementation_cannot_be_deleted(self):
        def _foo():
            return 'FOO'
        hooked = self._callFUT(_foo)
        def _try():
            del hooked.implementation
        self.assertRaises((TypeError, AttributeError), _try)

    def test_no_args(self):
        self.assertRaises(TypeError, self._callFUT)

    def test_too_many_args(self):
        def _foo():
            return 'FOO'
        self.assertRaises(TypeError, self._callFUT, _foo, _foo)

    def test_w_implementation_kwarg(self):
        def _foo():
            return 'FOO'
        hooked = self._callFUT(implementation=_foo)
        self.assertTrue(hooked.original is _foo)
        self.assertTrue(hooked.implementation is _foo)
        self.assertEqual(hooked(), 'FOO')

    def test_w_unknown_kwarg(self):
        def _foo():
            return 'FOO'
        self.assertRaises(TypeError, self._callFUT, nonesuch=_foo)


class HookableTests(PyHookableTests):

    def _callFUT(self, *args, **kw):
        from zope.hookable import hookable
        return hookable(*args, **kw)


def test_suite():
    return unittest.TestSuite((
        unittest.makeSuite(PyHookableTests),
        unittest.makeSuite(HookableTests),
    ))

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

:: Make Dir ::
 
[ Read-Only ]
:: Make File ::
 
[ Read-Only ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.0 [PHP 7 Update] [25.02.2019] maintained by KaizenLouie | C99Shell Github | Generation time: 0.0053 ]--