def test_buildWithDeprecated(self):
        """
        The templates and System for Twisted includes adding deprecations.
        """
        stdout = BytesIO()
        self.patch(sys, 'stdout', stdout)

        projectName = "Foobar"
        packageName = "quux"
        projectURL = "scheme:project"
        sourceURL = "scheme:source"
        docstring = "text in docstring"
        privateDocstring = "should also appear in output"

        inputPath = FilePath(self.mktemp()).child(packageName)
        inputPath.makedirs()
        inputPath.child("__init__.py").setContent(
            u"from twisted.python.deprecate import deprecated\n"
            u"from incremental import Version\n"
            u"@deprecated(Version('Twisted', 15, 0, 0), "
            u"'Baz')\n"
            u"def foo():\n"
            u"    '{}'\n"
            u"from twisted.python import deprecate\n"
            u"import incremental\n"
            u"@deprecate.deprecated(incremental.Version('Twisted', 16, 0, 0))\n"
            u"def _bar():\n"
            u"    '{}'\n"
            u"@deprecated(Version('Twisted', 14, 2, 3), replacement='stuff')\n"
            u"class Baz(object):\n"
            u"    pass"
            u"".format(docstring, privateDocstring).encode("utf-8"))

        outputPath = FilePath(self.mktemp())

        builder = APIBuilder()
        builder.build(projectName, projectURL, sourceURL, inputPath,
                      outputPath)

        quuxPath = outputPath.child("quux.html")
        self.assertTrue(
            quuxPath.exists(),
            "Package documentation file %r did not exist." % (quuxPath.path,))

        self.assertIn(
            docstring, quuxPath.getContent(),
            "Docstring not in package documentation file.")
        self.assertIn(
            'foo was deprecated in Twisted 15.0.0; please use Baz instead.',
            quuxPath.getContent())
        self.assertIn(
            '_bar was deprecated in Twisted 16.0.0.',
            quuxPath.getContent())
        self.assertIn(privateDocstring, quuxPath.getContent())

        # There should also be a page for the foo function in quux.
        self.assertTrue(quuxPath.sibling('quux.foo.html').exists())

        self.assertIn(
            'foo was deprecated in Twisted 15.0.0; please use Baz instead.',
            quuxPath.sibling('quux.foo.html').getContent())

        self.assertIn(
            'Baz was deprecated in Twisted 14.2.3; please use stuff instead.',
            quuxPath.sibling('quux.Baz.html').getContent())


        self.assertEqual(stdout.getvalue(), '')

        The templates and System for Twisted includes adding deprecations.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/python/test/test_release.py