コード例 #1
0
ファイル: test_reflectpy3.py プロジェクト: hensing/twisted
 def test_inheritedMethod(self):
     """
     L{prefixedMethodNames} returns a list included methods with the given
     prefix defined on base classes of the class passed to it.
     """
     class Child(Separate):
         pass
     self.assertEqual(["method"], prefixedMethodNames(Child, "good_"))
コード例 #2
0
ファイル: test_reflectpy3.py プロジェクト: 309972460/software
    def test_inheritedMethod(self):
        """
        L{prefixedMethodNames} returns a list included methods with the given
        prefix defined on base classes of the class passed to it.
        """
        class Child(Separate):
            pass

        self.assertEqual(["method"], prefixedMethodNames(Child, "good_"))
コード例 #3
0
ファイル: resource.py プロジェクト: 309972460/software
def _computeAllowedMethods(resource):
    """
    Compute the allowed methods on a C{Resource} based on defined render_FOO
    methods. Used when raising C{UnsupportedMethod} but C{Resource} does
    not define C{allowedMethods} attribute.
    """
    allowedMethods = []
    for name in prefixedMethodNames(resource.__class__, "render_"):
        # Potentially there should be an API for encode('ascii') in this
        # situation - an API for taking a Python native string (bytes on Python
        # 2, text on Python 3) and returning a socket-compatible string type.
        allowedMethods.append(name.encode('ascii'))
    return allowedMethods
コード例 #4
0
ファイル: resource.py プロジェクト: AlexanderHerlan/syncpy
def _computeAllowedMethods(resource):
    """
    Compute the allowed methods on a C{Resource} based on defined render_FOO
    methods. Used when raising C{UnsupportedMethod} but C{Resource} does
    not define C{allowedMethods} attribute.
    """
    allowedMethods = []
    for name in prefixedMethodNames(resource.__class__, "render_"):
        # Potentially there should be an API for encode('ascii') in this
        # situation - an API for taking a Python native string (bytes on Python
        # 2, text on Python 3) and returning a socket-compatible string type.
        allowedMethods.append(name.encode('ascii'))
    return allowedMethods
コード例 #5
0
ファイル: test_reflectpy3.py プロジェクト: hensing/twisted
 def test_method(self):
     """
     L{prefixedMethodNames} returns a list including methods with the given
     prefix defined on the class passed to it.
     """
     self.assertEqual(["method"], prefixedMethodNames(Separate, "good_"))
コード例 #6
0
ファイル: test_reflectpy3.py プロジェクト: 309972460/software
 def test_method(self):
     """
     L{prefixedMethodNames} returns a list including methods with the given
     prefix defined on the class passed to it.
     """
     self.assertEqual(["method"], prefixedMethodNames(Separate, "good_"))