Ticket #2375: proper-epytext-2375.patch

File proper-epytext-2375.patch, 39.6 KB (added by thijs, 8 years ago)

patch against r24262

  • twisted/python/test/test_util.py

     
    6767
    6868    def testNameToLabel(self):
    6969        """
    70         Test the various kinds of inputs L{nameToLabel} supports.
     70        Test the various kinds of inputs C{nameToLabel} supports.
    7171        """
    7272        nameData = [
    7373            ('f', 'F'),
     
    8585
    8686    def test_uidFromNumericString(self):
    8787        """
    88         When L{uidFromString} is called with a base-ten string representation
     88        When C{uidFromString} is called with a base-ten string representation
    8989        of an integer, it returns the integer.
    9090        """
    9191        self.assertEqual(util.uidFromString("100"), 100)
     
    9393
    9494    def test_uidFromUsernameString(self):
    9595        """
    96         When L{uidFromString} is called with a base-ten string representation
     96        When C{uidFromString} is called with a base-ten string representation
    9797        of an integer, it returns the integer.
    9898        """
    9999        pwent = pwd.getpwuid(os.getuid())
     
    105105
    106106    def test_gidFromNumericString(self):
    107107        """
    108         When L{gidFromString} is called with a base-ten string representation
     108        When C{gidFromString} is called with a base-ten string representation
    109109        of an integer, it returns the integer.
    110110        """
    111111        self.assertEqual(util.gidFromString("100"), 100)
     
    113113
    114114    def test_gidFromGroupnameString(self):
    115115        """
    116         When L{gidFromString} is called with a base-ten string representation
     116        When C{gidFromString} is called with a base-ten string representation
    117117        of an integer, it returns the integer.
    118118        """
    119119        grent = grp.getgrgid(os.getgid())
     
    126126
    127127class TestMergeFunctionMetadata(unittest.TestCase):
    128128    """
    129     Tests for L{mergeFunctionMetadata}.
     129    Tests for C{mergeFunctionMetadata}.
    130130    """
    131131
    132132    def test_mergedFunctionBehavesLikeMergeTarget(self):
     
    280280
    281281class PasswordTestingProcessProtocol(ProcessProtocol):
    282282    """
    283     Write the string C{"secret\n"} to a subprocess and then collect all of
     283    Write the string C{"secret\\n"} to a subprocess and then collect all of
    284284    its output and fire a Deferred with it when the process ends.
    285285    """
    286286    def connectionMade(self):
     
    438438
    439439class Record(util.FancyEqMixin):
    440440    """
    441     Trivial user of L{FancyEqMixin} used by tests.
     441    Trivial user of C{FancyEqMixin} used by tests.
    442442    """
    443443    compareAttributes = ('a', 'b')
    444444
     
    450450
    451451class DifferentRecord(util.FancyEqMixin):
    452452    """
    453     Trivial user of L{FancyEqMixin} which is not related to L{Record}.
     453    Trivial user of C{FancyEqMixin} which is not related to L{Record}.
    454454    """
    455455    compareAttributes = ('a', 'b')
    456456
     
    458458        self.a = a
    459459        self.b = b
    460460
    461 
    462 
    463461class DerivedRecord(Record):
    464462    """
    465463    A class with an inheritance relationship to L{Record}.
     
    495493
    496494class EqualityTests(unittest.TestCase):
    497495    """
    498     Tests for L{FancyEqMixin}.
     496    Tests for C{FancyEqMixin}.
    499497    """
    500498    def test_identity(self):
    501499        """
    502         Instances of a class which mixes in L{FancyEqMixin} but which
     500        Instances of a class which mixes in C{FancyEqMixin} but which
    503501        defines no comparison attributes compare by identity.
    504502        """
    505503        class Empty(util.FancyEqMixin):
     
    514512
    515513    def test_equality(self):
    516514        """
    517         Instances of a class which mixes in L{FancyEqMixin} should compare
    518         equal if all of their attributes compare equal.  They should not
    519         compare equal if any of their attributes do not compare equal.
     515        Instances of a class which mixes in C{FancyEqMixin} should
     516        compare equal if all of their attributes compare equal. They
     517        should not compare equal if any of their attributes do not
     518        compare equal.
    520519        """
    521520        self.assertTrue(Record(1, 2) == Record(1, 2))
    522521        self.assertFalse(Record(1, 2) == Record(1, 3))
     
    526525
    527526    def test_unequality(self):
    528527        """
    529         Unequality between instances of a particular L{record} should be
     528        Unequality between instances of a particular C{record} should be
    530529        defined as the negation of equality.
    531530        """
    532531        self.assertFalse(Record(1, 2) != Record(1, 2))
     
    537536
    538537    def test_differentClassesEquality(self):
    539538        """
    540         Instances of different classes which mix in L{FancyEqMixin} should not
    541         compare equal.
     539        Instances of different classes which mix in C{FancyEqMixin} 
     540        should not compare equal.
    542541        """
    543542        self.assertFalse(Record(1, 2) == DifferentRecord(1, 2))
    544543
    545544
    546545    def test_differentClassesInequality(self):
    547546        """
    548         Instances of different classes which mix in L{FancyEqMixin} should
    549         compare unequal.
     547        Instances of different classes which mix in C{FancyEqMixin}
     548        should compare unequal.
    550549        """
    551550        self.assertTrue(Record(1, 2) != DifferentRecord(1, 2))
    552551
     
    554553    def test_inheritedClassesEquality(self):
    555554        """
    556555        An instance of a class which derives from a class which mixes in
    557         L{FancyEqMixin} should compare equal to an instance of the base class
    558         if and only if all of their attributes compare equal.
     556        C{FancyEqMixin} should compare equal to an instance of the
     557        base class if and only if all of their attributes compare equal.
    559558        """
    560559        self.assertTrue(Record(1, 2) == DerivedRecord(1, 2))
    561560        self.assertFalse(Record(1, 2) == DerivedRecord(1, 3))
     
    566565    def test_inheritedClassesInequality(self):
    567566        """
    568567        An instance of a class which derives from a class which mixes in
    569         L{FancyEqMixin} should compare unequal to an instance of the base
    570         class if any of their attributes compare unequal.
     568        C{FancyEqMixin} should compare unequal to an instance of
     569        the base class if any of their attributes compare unequal.
    571570        """
    572571        self.assertFalse(Record(1, 2) != DerivedRecord(1, 2))
    573572        self.assertTrue(Record(1, 2) != DerivedRecord(1, 3))
     
    579578        """
    580579        The right-hand argument to the equality operator is given a chance
    581580        to determine the result of the operation if it is of a type
    582         unrelated to the L{FancyEqMixin}-based instance on the left-hand
    583         side.
     581        unrelated to the C{FancyEqMixin}-based instance on the
     582        left-hand side.
    584583        """
    585584        self.assertTrue(Record(1, 2) == EqualToEverything())
    586585        self.assertFalse(Record(1, 2) == EqualToNothing())
     
    590589        """
    591590        The right-hand argument to the non-equality operator is given a
    592591        chance to determine the result of the operation if it is of a type
    593         unrelated to the L{FancyEqMixin}-based instance on the left-hand
    594         side.
     592        unrelated to the C{FancyEqMixin}-based instance on the
     593        left-hand side.
    595594        """
    596595        self.assertFalse(Record(1, 2) != EqualToEverything())
    597596        self.assertTrue(Record(1, 2) != EqualToNothing())
  • twisted/python/test/test_release.py

     
    22# See LICENSE for details.
    33
    44"""
    5 Tests for L{twisted.python.release} and L{twisted.python._release}.
     5Tests for C{twisted.python.release} and C{twisted.python._release}.
    66"""
    77
    88import warnings
     
    134134        Make a Twisted-style project in the given base directory.
    135135
    136136        @param baseDirectory: The directory to create files in
    137             (as a L{FilePath).
     137            (as a L{FilePath}).
    138138        @param version: The version information for the project.
    139139        @return: L{Project} pointing to the created project.
    140140        """
     
    475475    def setUp(self):
    476476        """
    477477        Set up a few instance variables that will be useful.
    478 
    479         @ivar builder: A plain L{DocBuilder}.
    480         @ivar docCounter: An integer to be used as a counter by the
    481             C{getArbitrary...} methods.
    482         @ivar howtoDir: A L{FilePath} representing a directory to be used for
    483             containing Lore documents.
    484         @ivar templateFile: A L{FilePath} representing a file with
    485             C{self.template} as its content.
    486478        """
    487479        BuilderTestsMixin.setUp(self)
    488480        self.builder = DocBuilder()
     481        """
     482        @ivar: A plain L{DocBuilder}.
     483        """
    489484        self.howtoDir = FilePath(self.mktemp())
     485        """
     486        @ivar: A L{FilePath} representing a directory to be used for
     487            containing Lore documents.
     488        """
    490489        self.howtoDir.createDirectory()
    491490        self.templateFile = self.howtoDir.child("template.tpl")
     491        """
     492        @ivar: A L{FilePath} representing a file with
     493            C{self.template} as its content.
     494        """
    492495        self.templateFile.setContent(self.template)
    493496
    494497
     
    573576
    574577    def test_deleteInput(self):
    575578        """
    576         L{DocBuilder.build} can be instructed to delete the input files after
     579        C{DocBuilder.build} can be instructed to delete the input files after
    577580        generating the output based on them.
    578581        """
    579582        input1 = self.getArbitraryLoreInput(0)
     
    647650
    648651    def test_build(self):
    649652        """
    650         L{APIBuilder.build} writes an index file which includes the name of the
     653        C{APIBuilder.build} writes an index file which includes the name of the
    651654        project specified.
    652655        """
    653656        stdout = StringIO()
     
    714717    def setUp(self):
    715718        """
    716719        Set up a few instance variables that will be useful.
    717 
    718         @ivar builder: A plain L{ManBuilder}.
    719         @ivar manDir: A L{FilePath} representing a directory to be used for
    720             containing man pages.
    721720        """
    722721        BuilderTestsMixin.setUp(self)
    723722        self.builder = ManBuilder()
     723        """
     724        @ivar: A plain L{ManBuilder}.
     725        """
    724726        self.manDir = FilePath(self.mktemp())
     727        """
     728        @ivar: A L{FilePath} representing a directory to be used for
     729            containing man pages.
     730        """
    725731        self.manDir.createDirectory()
    726732
    727733
    728734    def test_noDocumentsFound(self):
    729735        """
    730         L{ManBuilder.build} raises L{NoDocumentsFound} if there are no
     736        C{ManBuilder.build} raises L{NoDocumentsFound} if there are no
    731737        .1 files in the given directory.
    732738        """
    733739        self.assertRaises(NoDocumentsFound, self.builder.build, self.manDir)
     
    735741
    736742    def test_build(self):
    737743        """
    738         Check that L{ManBuilder.build} find the man page in the directory, and
     744        Check that C{ManBuilder.build} find the man page in the directory, and
    739745        successfully produce a Lore content.
    740746        """
    741747        manContent = self.getArbitraryManInput()
     
    751757    def test_toHTML(self):
    752758        """
    753759        Check that the content output by C{build} is compatible as input of
    754         L{DocBuilder.build}.
     760        C{DocBuilder.build}.
    755761        """
    756762        manContent = self.getArbitraryManInput()
    757763        self.manDir.child('test1.1').setContent(manContent)
     
    815821
    816822    def test_runSuccess(self):
    817823        """
    818         L{BookBuilder.run} executes the command it is passed and returns a
     824        C{BookBuilder.run} executes the command it is passed and returns a
    819825        string giving the stdout and stderr of the command if it completes
    820826        successfully.
    821827        """
     
    825831
    826832    def test_runFailed(self):
    827833        """
    828         L{BookBuilder.run} executes the command it is passed and raises
     834        C{BookBuilder.run} executes the command it is passed and raises
    829835        L{CommandFailed} if it completes unsuccessfully.
    830836        """
    831837        builder = BookBuilder()
     
    836842
    837843    def test_runSignaled(self):
    838844        """
    839         L{BookBuilder.run} executes the command it is passed and raises
     845        C{BookBuilder.run} executes the command it is passed and raises
    840846        L{CommandFailed} if it exits due to a signal.
    841847        """
    842848        builder = BookBuilder()
     
    850856
    851857    def test_buildTeX(self):
    852858        """
    853         L{BookBuilder.buildTeX} writes intermediate TeX files for all lore
     859        C{BookBuilder.buildTeX} writes intermediate TeX files for all lore
    854860        input files in a directory.
    855861        """
    856862        version = "3.2.1"
     
    870876
    871877    def test_buildTeXRejectsInvalidDirectory(self):
    872878        """
    873         L{BookBuilder.buildTeX} raises L{ValueError} if passed a directory
     879        C{BookBuilder.buildTeX} raises L{ValueError} if passed a directory
    874880        which does not exist.
    875881        """
    876882        builder = BookBuilder()
     
    880886
    881887    def test_buildTeXOnlyBuildsXHTML(self):
    882888        """
    883         L{BookBuilder.buildTeX} ignores files which which don't end with
     889        C{BookBuilder.buildTeX} ignores files which which don't end with
    884890        ".xhtml".
    885891        """
    886892        # Hopefully ">" is always a parse error from microdom!
     
    890896
    891897    def test_stdout(self):
    892898        """
    893         L{BookBuilder.buildTeX} does not write to stdout.
     899        C{BookBuilder.buildTeX} does not write to stdout.
    894900        """
    895901        stdout = StringIO()
    896902        self.patch(sys, 'stdout', stdout)
     
    904910
    905911    def test_buildPDFRejectsInvalidBookFilename(self):
    906912        """
    907         L{BookBuilder.buildPDF} raises L{ValueError} if the book filename does
     913        C{BookBuilder.buildPDF} raises L{ValueError} if the book filename does
    908914        not end with ".tex".
    909915        """
    910916        builder = BookBuilder()
     
    941947
    942948    def test_buildPDF(self):
    943949        """
    944         L{BookBuilder.buildPDF} creates a PDF given an index tex file and a
     950        C{BookBuilder.buildPDF} creates a PDF given an index tex file and a
    945951        directory containing .tex files.
    946952        """
    947953        bookPath = self._setupTeXFiles()
     
    955961
    956962    def test_buildPDFLongPath(self):
    957963        """
    958         L{BookBuilder.buildPDF} succeeds even if the paths it is operating on
     964        C{BookBuilder.buildPDF} succeeds even if the paths it is operating on
    959965        are very long.
    960966
    961967        C{ps2pdf13} seems to have problems when path names are long.  This test
     
    978984
    979985    def test_buildPDFRunsLaTeXThreeTimes(self):
    980986        """
    981         L{BookBuilder.buildPDF} runs C{latex} three times.
     987        C{BookBuilder.buildPDF} runs C{latex} three times.
    982988        """
    983989        class InspectableBookBuilder(BookBuilder):
    984990            def __init__(self):
     
    10241030    def test_noSideEffects(self):
    10251031        """
    10261032        The working directory is the same before and after a call to
    1027         L{BookBuilder.buildPDF}.  Also the contents of the directory containing
     1033        C{BookBuilder.buildPDF}.  Also the contents of the directory containing
    10281034        the input book are the same before and after the call.
    10291035        """
    10301036        startDir = os.getcwd()
     
    10421048
    10431049    def test_failedCommandProvidesOutput(self):
    10441050        """
    1045         If a subprocess fails, L{BookBuilder.buildPDF} raises L{CommandFailed}
     1051        If a subprocess fails, C{BookBuilder.buildPDF} raises L{CommandFailed}
    10461052        with the subprocess's output and leaves the temporary directory as a
    10471053        sibling of the book path.
    10481054        """
     
    10641070
    10651071    def test_build(self):
    10661072        """
    1067         L{BookBuilder.build} generates a pdf book file from some lore input
     1073        C{BookBuilder.build} generates a pdf book file from some lore input
    10681074        files.
    10691075        """
    10701076        sections = range(1, 4)
     
    10821088
    10831089    def test_buildRemovesTemporaryLaTeXFiles(self):
    10841090        """
    1085         L{BookBuilder.build} removes the intermediate LaTeX files it creates.
     1091        C{BookBuilder.build} removes the intermediate LaTeX files it creates.
    10861092        """
    10871093        sections = range(1, 4)
    10881094        for sectionNumber in sections:
     
    13391345        """
    13401346        The subproject tarball includes files like so:
    13411347
    1342         1. twisted/<subproject>/topfiles defines the files that will be in the
    1343            top level in the tarball, except LICENSE, which comes from the real
    1344            top-level directory.
    1345         2. twisted/<subproject> is included, but without the topfiles entry
    1346            in that directory. No other twisted subpackages are included.
    1347         3. twisted/plugins/twisted_<subproject>.py is included, but nothing
    1348            else in plugins is.
     1348         1. twisted/<subproject>/topfiles defines the files that will be in the
     1349            top level in the tarball, except LICENSE, which comes from the real
     1350            top-level directory.
     1351         2. twisted/<subproject> is included, but without the topfiles entry
     1352            in that directory. No other twisted subpackages are included.
     1353         3. twisted/plugins/twisted_<subproject>.py is included, but nothing
     1354            else in plugins is.
    13491355        """
    13501356        structure = {
    13511357            "README": "HI!@",
     
    14401446        The core tarball looks a lot like a subproject tarball, except it
    14411447        doesn't include:
    14421448
    1443         - Python packages from other subprojects
    1444         - plugins from other subprojects
    1445         - scripts from other subprojects
     1449         - Python packages from other subprojects
     1450         - plugins from other subprojects
     1451         - scripts from other subprojects
    14461452        """
    14471453        indexInput, indexOutput = self.getArbitraryLoreInputAndOutput(
    14481454            "8.0.0", prefix="howto/")
  • twisted/protocols/ftp.py

     
    22162216        Retrieves a file or listing generated by the given command,
    22172217        feeding it to the given protocol.
    22182218
    2219         @param command: list of strings of FTP commands to execute then receive
     2219        @param commands: list of strings of FTP commands to execute then receive
    22202220            the results of (e.g. LIST, RETR)
    2221         @param protocol: A L{Protocol} *instance* e.g. an
     2221        @param protocol: A L{Protocol} B{instance} e.g. an
    22222222            L{FTPFileListProtocol}, or something that can be adapted to one.
    22232223            Typically this will be an L{IConsumer} implemenation.
    22242224
  • twisted/conch/test/test_conch.py

     
    7070        """
    7171        Called when the process has ended.
    7272
    73         @param reason: a Failure giving the reason for the process' end.
     73        @param reason: a C{Failure} giving the reason for the process' end.
    7474        """
    7575        if reason.value.exitCode != 0:
    7676            self._getDeferred().errback(
     
    104104        (it is assumed that the server is running on localhost).
    105105
    106106        @type data: C{str}
    107         @param data: This is sent to the third-party server. Must end with '\n'
     107        @param data: This is sent to the third-party server. Must end with '\\n'
    108108        in order to trigger a disconnect.
    109109        """
    110110        self.port = port
     
    179179    def __init__(self, protocol, data):
    180180        """
    181181        @type protocol: L{ConchTestForwardingProcess}
    182         @param protocol: The L{ProcessProtocol} which made this connection.
     182        @param protocol: The C{ProcessProtocol} which made this connection.
    183183
    184184        @type data: str
    185185        @param data: The data to be sent to the third-party server.
     
    306306    protocols over SSH.
    307307
    308308    These tests are integration tests, not unit tests. They launch a Conch
    309     server, a custom TCP server (just an L{EchoProtocol}) and then call
    310     L{execute}.
     309    server, a custom TCP server (just an C{EchoProtocol}) and then call
     310    C{execute}.
    311311
    312     L{execute} is implemented by subclasses of L{ForwardingTestBase}. It should
     312    C{execute} is implemented by subclasses of L{ForwardingTestBase}. It should
    313313    cause an SSH client to connect to the Conch server, asking it to forward
    314314    data to the custom TCP server.
    315315    """
     
    342342    def _makeConchFactory(self):
    343343        """
    344344        Make a L{ConchTestServerFactory}, which allows us to start a
    345         L{ConchTestServer} -- i.e. an actually listening conch.
     345        C{ConchTestServer} -- i.e. an actually listening conch.
    346346        """
    347347        realm = ConchTestRealm()
    348348        p = portal.Portal(realm)
     
    429429        @type sshArgs: str
    430430        @param sshArgs: Arguments to pass to the 'ssh' process.
    431431
    432         @return: L{defer.Deferred}
     432        @return: C{defer.Deferred}
    433433        """
    434434        process.deferred = defer.Deferred()
    435435        cmdline = ('ssh -2 -l testuser -p %i '
     
    554554    def execute(self, remoteCommand, process, sshArgs=''):
    555555        """
    556556        Connect to the forwarding process using the 'unix' client found in
    557         L{twisted.conch.client.unix.connect}.  See
     557        C{twisted.conch.client.unix.connect}.See
    558558        L{OpenSSHClientTestCase.execute}.
    559559        """
    560560        process.deferred = defer.Deferred()
     
    575575    def test_noHome(self):
    576576        """
    577577        When setting the HOME environment variable to a path that doesn't
    578         exist, L{connect.connect} should forward the failure, and the created
     578        exist, C{connect.connect} should forward the failure, and the created
    579579        process should fail with a L{ConchError}.
    580580        """
    581581        path = self.mktemp()
  • twisted/conch/test/test_insults.py

     
    370370    """
    371371    def test_nextLine(self):
    372372        """
    373         L{ServerProtocol.nextLine} writes C{"\r\n"} to its transport.
     373        L{ServerProtocol.nextLine} writes C{"\\r\\n"} to its transport.
    374374        """
    375375        # Why doesn't it write ESC E?  Because ESC E is poorly supported.  For
    376376        # example, gnome-terminal (many different versions) fails to scroll if
  • twisted/conch/test/test_helper.py

     
    3838
    3939    def test_carriageReturn(self):
    4040        """
    41         C{"\r"} moves the cursor to the first column in the current row.
     41        C{"\\r"} moves the cursor to the first column in the current row.
    4242        """
    4343        self.term.cursorForward(5)
    4444        self.term.cursorDown(3)
     
    4949
    5050    def test_linefeed(self):
    5151        """
    52         C{"\n"} moves the cursor to the next row without changing the column.
     52        C{"\\n"} moves the cursor to the next row without changing the column.
    5353        """
    5454        self.term.cursorForward(5)
    5555        self.assertEqual(self.term.reportCursorPosition(), (5, 0))
     
    5959
    6060    def test_newline(self):
    6161        """
    62         C{write} transforms C{"\n"} into C{"\r\n"}.
     62        C{write} transforms C{"\\n"} into C{"\\r\\n"}.
    6363        """
    6464        self.term.cursorForward(5)
    6565        self.term.cursorDown(3)
     
    7070
    7171    def test_setPrivateModes(self):
    7272        """
    73         Verify that L{helper.TerminalBuffer.setPrivateModes} changes the Set
     73        Verify that C{helper.TerminalBuffer.setPrivateModes} changes the Set
    7474        Mode (SM) state to "set" for the private modes it is passed.
    7575        """
    7676        expected = self.term.privateModes.copy()
     
    8282
    8383    def test_resetPrivateModes(self):
    8484        """
    85         Verify that L{helper.TerminalBuffer.resetPrivateModes} changes the Set
     85        Verify that C{helper.TerminalBuffer.resetPrivateModes} changes the Set
    8686        Mode (SM) state to "reset" for the private modes it is passed.
    8787        """
    8888        expected = self.term.privateModes.copy()
  • twisted/web2/test/test_vhost.py

     
    2222        self.root.addHost('foo', HostResource())
    2323
    2424    def testNameVirtualHost(self):
    25         """ Test basic Name Virtual Host behavior
    26             1) NameVirtualHost.default is defined, so an undefined NVH (localhost)
    27                 gets handled by NameVirtualHost.default
     25        """
     26        Test basic Name Virtual Host behavior
     27         1. NameVirtualHost.default is defined, so an undefined NVH (localhost)
     28            gets handled by NameVirtualHost.default
    2829
    29             2) A defined NVH gets passed the proper host header and is handled by the proper resource
     30         2. A defined NVH gets passed the proper host header and is handled by the proper resource
    3031        """
    3132
    3233        self.assertResponse(
     
    4647            (404, {}, None))
    4748
    4849    def testNameVirtualHostWithChildren(self):
    49         """ Test that children of a defined NVH are handled appropriately
    5050        """
     51        Test that children of a defined NVH are handled appropriately
     52        """
    5153       
    5254        self.assertResponse(
    5355            (self.root, 'http://foo/bar/'),
    5456            (200, {}, 'foo'))
    5557
    5658    def testNameVirtualHostWithNesting(self):
    57         """ Test that an unknown virtual host gets handled by the domain parent
    58             and passed on to the parent's resource.
    5959        """
     60        Test that an unknown virtual host gets handled by the domain parent
     61        and passed on to the parent's resource.
     62        """
    6063
    6164        nested = vhost.NameVirtualHost()
    6265        nested.addHost('is.nested', HostResource())
  • twisted/web2/test/test_wsgi.py

     
    2323
    2424    def flushErrors(self, result, error):
    2525        """
    26         Flush the specified C{error] and forward C{result}.
     26        Flush the specified C{error} and forward C{result}.
    2727        """
    2828        self.flushLoggedErrors(error)
    2929        return result
  • twisted/flow/test/test_flow.py

     
    1616from time import sleep
    1717
    1818class slowlist:
    19     """ this is a generator based list
     19    """
     20    This is a generator based list::
    2021
    2122        def slowlist(list):
    2223            list = list[:]
     
    4041_onetwothree = ['one','two',flow.Cooperate(),'three']
    4142
    4243class producer:
    43     """ iterator version of the following generator...
     44    """
     45    iterator version of the following generator...::
    4446
    4547        def producer():
    4648            lst = flow.wrap(slowlist([1,2,3]))
     
    6769        return (self.lst.next(), self.nam.next())
    6870
    6971class consumer:
    70     """ iterator version of the following generator...
     72    """
     73    iterator version of the following generator...::
    7174
    7275        def consumer():
    7376            title = flow.wrap(['Title'])
     
    99102
    100103
    101104class badgen:
    102     """ a bad generator...
     105    """
     106    A bad generator...::
    103107
    104     def badgen():
    105         yield 'x'
    106         err =  3/ 0
     108        def badgen():
     109            yield 'x'
     110            err =  3/ 0
    107111    """
    108112    def __iter__(self):
    109113        self.next = self.yield_x
     
    116120        raise StopIteration
    117121
    118122class buildlist:
    119     """ building a list
     123    """
     124    Building a list::
    120125
    121126        def buildlist(src):
    122127            out = []
     
    146151        raise StopIteration
    147152
    148153class testconcur:
    149     """ interweving two concurrent stages
     154    """
     155    Interweving two concurrent stages::
    150156
    151157        def testconcur(*stages):
    152158            both = flow.Concurrent(*stages)
     
    169175        return (stage.name, stage.next())
    170176
    171177class echoServer:
    172     """ a simple echo protocol, server side
     178    """
     179    A simple echo protocol, server side::
    173180
    174181        def echoServer(conn):
    175182            yield conn
     
    190197        return self.conn.next()
    191198
    192199class echoClient:
    193     """ a simple echo client tester
     200    """
     201    A simple echo client tester::
    194202
    195203        def echoClient(conn):
    196204            yield "testing"
     
    461469
    462470    def testThreadedImmediate(self):
    463471        """
    464             The goal of this test is to test the callback mechanism with
    465             regard to threads, namely to assure that results can be
    466             accumulated before they are needed; and that left-over results
    467             are immediately made available on the next round (even though
    468             the producing thread has shut down).  This is a very tough thing
    469             to test due to the timing issues.  So it may fail on some
    470             platforms, I'm not sure.
     472        The goal of this test is to test the callback mechanism with
     473        regard to threads, namely to assure that results can be
     474        accumulated before they are needed; and that left-over results
     475        are immediately made available on the next round (even though
     476        the producing thread has shut down).  This is a very tough thing
     477        to test due to the timing issues.  So it may fail on some
     478        platforms, I'm not sure.
    471479        """
    472480        expect = [5,4,3,2,1]
    473481        result = []
  • twisted/web/test/test_xml.py

     
    688688    """
    689689    Tests for when microdom encounters very bad HTML and C{beExtremelyLenient}
    690690    is enabled. These tests are inspired by some HTML generated in by a mailer,
    691     which breaks up very long lines by splitting them with '!\n '. The expected
     691    which breaks up very long lines by splitting them with '!\\n '. The expected
    692692    behaviour is loosely modelled on the way Firefox treats very bad HTML.
    693693    """
    694694
  • twisted/web/test/test_httpauth.py

     
    366366        Format all given keyword arguments and their values suitably for use as
    367367        the value of an HTTP header.
    368368
    369         @types quotes: C{bool}
    370369        @param quotes: A flag indicating whether to quote the values of each
    371370            field in the response.
    372 
    373         @param **kw: Keywords and C{str} values which will be treated as field
     371        @type quotes: C{bool}
     372       
     373        @param kw: Keywords and C{str} values which will be treated as field
    374374            name/value pairs to include in the result.
    375375
    376376        @rtype: C{str}
  • twisted/test/test_reflect.py

     
    187187        """
    188188        Passing a name which isn't a fully-qualified Python name to L{namedAny}
    189189        should result in one of the following exceptions:
    190         - L{InvalidName}: the name is not a dot-separated list of Python objects
    191         - L{ObjectNotFound}: the object doesn't exist
    192         - L{ModuleNotFound}: the object doesn't exist and there is only one
    193           component in the name
     190       
     191         - L{InvalidName}: the name is not a dot-separated list of Python objects
     192         - L{ObjectNotFound}: the object doesn't exist
     193         - L{ModuleNotFound}: the object doesn't exist and there is only one
     194           component in the name
    194195        """
    195196        err = self.assertRaises(reflect.ModuleNotFound, reflect.namedAny,
    196197                                'nosuchmoduleintheworld')
  • twisted/test/test_ftp.py

     
    910910        """
    911911        Try a RETR, but disconnect during the transfer.
    912912        L{ftp.FTPClient.retrieveFile} should return a Deferred which
    913         errbacks with L{ftp.ConnectionLost)
     913        errbacks with L{ftp.ConnectionLost}.
    914914        """
    915915        self.client.passive = False
    916916
  • twisted/test/test_process.py

     
    11811181    @type actions: C{list} of C{str}
    11821182
    11831183    @ivar closed: keep track of the file descriptor closed.
    1184     @param closed: C{list} of C{int}
     1184    @type closed: C{list} of C{int}
    11851185
    11861186    @ivar child: whether fork return for the child or the parent.
    11871187    @type child: C{bool}
     
    15311531        The garbage collector should be enabled when L{reactor.spawnProcess}
    15321532        returns if it was initially enabled.
    15331533
    1534         @see L{_mockForkInParentTest}
     1534        @see: L{_mockForkInParentTest}
    15351535        """
    15361536        gc.enable()
    15371537        self._mockForkInParentTest()
     
    15431543        The garbage collector should be disabled when L{reactor.spawnProcess}
    15441544        returns if it was initially disabled.
    15451545
    1546         @see L{_mockForkInParentTest}
     1546        @see: L{_mockForkInParentTest}
    15471547        """
    15481548        gc.disable()
    15491549        self._mockForkInParentTest()
  • twisted/test/test_amp.py

     
    398398class FakeSender:
    399399    """
    400400    This is a fake implementation of the 'box sender' interface implied by
    401     L{AMP}.
     401    L{amp.AMP}.
    402402    """
    403403    def __init__(self):
    404404        """
     
    699699    def test_receiveBoxStateMachine(self):
    700700        """
    701701        When a binary box protocol receives:
    702             * a key
    703             * a value
    704             * an empty string
     702         - a key
     703         - a value
     704         - an empty string
    705705        it should emit a box and send it to its boxReceiver.
    706706        """
    707707        a = amp.BinaryBoxProtocol(self)
  • twisted/test/test_internet.py

     
    658658        L{twisted.internet.reactor.seconds} should return something
    659659        like a number.
    660660
    661         1. This test specifically does not assert any relation to the
    662            "system time" as returned by L{time.time} or
    663            L{twisted.python.runtime.seconds}, because at some point we
    664            may find a better option for scheduling calls than
    665            wallclock-time.
    666         2. This test *also* does not assert anything about the type of
    667            the result, because operations may not return ints or
    668            floats: For example, datetime-datetime == timedelta(0).
     661         1. This test specifically does not assert any relation to the
     662            "system time" as returned by L{time.time} or
     663            L{twisted.python.runtime.seconds}, because at some point we
     664            may find a better option for scheduling calls than
     665            wallclock-time.
     666         2. This test B{also} does not assert anything about the type of
     667            the result, because operations may not return ints or
     668            floats: For example, C{datetime-datetime == timedelta(0)}.
    669669        """
    670670        now = reactor.seconds()
    671671        self.assertEquals(now-now+now, now)
  • twisted/mail/test/test_pop3.py

     
    22# See LICENSE for details.
    33
    44"""
    5 Test cases for Ltwisted.mail.pop3} module.
     5Test cases for L{twisted.mail.pop3} module.
    66"""
    77
    88import StringIO
  • twisted/internet/test/test_iocp.py

     
    5050        """
    5151        This test checks transport read state! There are three bits
    5252        of it:
    53         1) The transport producer is paused -- transport.reading
     53       
     54         1. The transport producer is paused -- transport.reading
    5455           is False)
    55         2) The transport is about to schedule an OS read, on the next
    56            reactor iteration -- transport._readScheduled
    57         3) The OS has a pending asynchronous read on our behalf --
    58            transport._readScheduledInOS
    59         if 3) is not implemented, it is possible to trick IOCPReactor into
    60         scheduling an OS read before the previous one finishes
     56         2. The transport is about to schedule an OS read, on the next
     57           reactor iteration -- C{transport._readScheduled}
     58         3. The OS has a pending asynchronous read on our behalf --
     59           C{transport._readScheduledInOS}
     60           
     61        If 3 is not implemented, it is possible to trick C{IOCPReactor}
     62        into scheduling an OS read before the previous one finishes
    6163        """
    6264        sf = ServerFactory()
    6365        sf.protocol = StopStartReadingProtocol
  • twisted/trial/test/test_reporter.py

     
    329329        indicating how many tests ran, how many failed etc.
    330330
    331331        The numbers represents:
    332          * the run time of the tests
    333          * the number of tests run, printed 2 times for legacy reasons
    334          * the number of errors
    335          * the number of failures
    336          * the number of skips
     332         - the run time of the tests
     333         - the number of tests run, printed 2 times for legacy reasons
     334         - the number of errors
     335         - the number of failures
     336         - the number of skips
    337337        """
    338338        result = reporter.MinimalReporter(self.stream)
    339339        self.test.run(result)
  • twisted/trial/reporter.py

     
    105105        self.failures.append((test, self._getFailure(fail)))
    106106
    107107    def addError(self, test, error):
    108         """Report an error that occurred while running the given test.
     108        """
     109        Report an error that occurred while running the given test.
    109110
    110111        @type test: L{pyunit.TestCase}
    111         @type fail: L{Failure} or L{tuple}
     112        @type error: L{Failure} or L{tuple}
    112113        """
    113114        self.errors.append((test, self._getFailure(error)))
    114115
     
    294295    """
    295296    A basic L{TestResult} with support for writing to a stream.
    296297   
    297     @param _startTime: The time when the first test was started. It defaults to
     298    @ivar _startTime: The time when the first test was started. It defaults to
    298299        C{None}, which means that no test was actually launched.
    299300    @type _startTime: C{float} or C{NoneType}
    300301    """
     
    378379        Safely write to the reporter's stream.
    379380
    380381        @param format: A format string to write.
    381         @param *args: The arguments for the format string.
     382        @param args: The arguments for the format string.
    382383        """
    383384        s = str(format)
    384385        assert isinstance(s, type(''))
     
    401402        the format string.
    402403
    403404        @param format: A format string to write.
    404         @param *args: The arguments for the format string.
     405        @param args: The arguments for the format string.
    405406        """
    406407        self._write(format, *args)
    407408        self._write('\n')