示例#1
0
    def test_privacyClassProtoHelpers(self):
        """
        The I{twisted.test.proto_helpers} module is visible.
        """
        sut = TwistedSystem()
        twistedPackage = model.Package(
            system=sut,
            name='twisted',
            docstring='ignored',
            parent=None,
            )
        twistedTestPackage = model.Package(
            system=sut,
            name='test',
            docstring='ignored',
            parent=twistedPackage,
            )
        twistedProtoHelpersModule = model.Module(
            system=sut,
            name='proto_helpers',
            docstring='ignored',
            parent=twistedTestPackage,
            )

        result = sut.privacyClass(twistedProtoHelpersModule)

        self.assertIs(result, model.PrivacyClass.VISIBLE)
示例#2
0
    def test_privacyClassChildTestModule(self):
        """
        Any child of the I{twisted.test} package is hidden.
        """
        sut = TwistedSystem()
        twistedPackage = model.Package(
            system=sut,
            name='twisted',
            docstring='ignored',
            parent=None,
            )
        twistedTestPackage = model.Package(
            system=sut,
            name='test',
            docstring='ignored',
            parent=twistedPackage,
            )
        twistedAnyTestModule = model.Module(
            system=sut,
            name='other_child',
            docstring='ignored',
            parent=twistedTestPackage,
            )


        result = sut.privacyClass(twistedAnyTestModule)

        self.assertIs(result, model.PrivacyClass.HIDDEN)
示例#3
0
    def test_privacyClassPublicCode(self):
        """
        Any child of the I{twisted} package has a privacy according to the
        general rules defined in pydoctor.
        """
        sut = TwistedSystem()
        twistedPackage = model.Package(
            system=sut,
            name="twisted",
            parent=None,
        )
        twistedSubProjectPackage = model.Package(
            system=sut,
            name="subproject",
            parent=twistedPackage,
        )
        twistedSubProjectModule = model.Module(
            system=sut,
            name="other_child",
            parent=twistedSubProjectPackage,
        )
        twistedPrivateModule = model.Module(
            system=sut,
            name="_private_child",
            parent=twistedSubProjectPackage,
        )

        result = sut.privacyClass(twistedSubProjectPackage)
        self.assertIs(result, model.PrivacyClass.VISIBLE)

        result = sut.privacyClass(twistedSubProjectModule)
        self.assertIs(result, model.PrivacyClass.VISIBLE)

        result = sut.privacyClass(twistedPrivateModule)
        self.assertIs(result, model.PrivacyClass.PRIVATE)
    def test_privacyClassChildTestModule(self):
        """
        Any child of the I{twisted.test} package is hidden.
        """
        sut = TwistedSystem()
        twistedPackage = model.Package(
            system=sut,
            name='twisted',
            docstring='ignored',
            parent=None,
            )
        twistedTestPackage = model.Package(
            system=sut,
            name='test',
            docstring='ignored',
            parent=twistedPackage,
            )
        twistedAnyTestModule = model.Module(
            system=sut,
            name='other_child',
            docstring='ignored',
            parent=twistedTestPackage,
            )


        result = sut.privacyClass(twistedAnyTestModule)

        self.assertIs(result, model.PrivacyClass.HIDDEN)
    def test_privacyClassProtoHelpers(self):
        """
        The I{twisted.test.proto_helpers} module is visible.
        """
        sut = TwistedSystem()
        twistedPackage = model.Package(
            system=sut,
            name='twisted',
            docstring='ignored',
            parent=None,
            )
        twistedTestPackage = model.Package(
            system=sut,
            name='test',
            docstring='ignored',
            parent=twistedPackage,
            )
        twistedProtoHelpersModule = model.Module(
            system=sut,
            name='proto_helpers',
            docstring='ignored',
            parent=twistedTestPackage,
            )

        result = sut.privacyClass(twistedProtoHelpersModule)

        self.assertIs(result, model.PrivacyClass.VISIBLE)
示例#6
0
    def test_initCustomSphinxInventory(self):
        """
        After initialization it has a custom C{intersphinx} member.
        """
        sut = TwistedSystem()

        self.assertIsInstance(sut.intersphinx, TwistedSphinxInventory)
示例#7
0
    def test_privacyClassBaseTestPackage(self):
        """
        The base I{twisted.test} package is visible to allow traversal to a
        few selected test API which is visible.
        """
        sut = TwistedSystem()
        twistedPackage = model.Package(
            system=sut,
            name="twisted",
            parent=None,
        )
        twistedTestPackage = model.Package(
            system=sut,
            name="test",
            parent=twistedPackage,
        )

        result = sut.privacyClass(twistedTestPackage)

        self.assertIs(result, model.PrivacyClass.VISIBLE)
    def test_privacyClassBaseTestPackage(self):
        """
        The base I{twisted.test} package is visible to allow traversal to a
        few selected test API which is visible.
        """
        sut = TwistedSystem()
        twistedPackage = model.Package(
            system=sut,
            name='twisted',
            docstring='ignored',
            parent=None,
            )
        twistedTestPackage = model.Package(
            system=sut,
            name='test',
            docstring='ignored',
            parent=twistedPackage,
            )

        result = sut.privacyClass(twistedTestPackage)

        self.assertIs(result, model.PrivacyClass.VISIBLE)
    def test_privacyClassPublicCode(self):
        """
        Any child of the I{twisted} package has a privacy according to the
        general rules defined in pydoctor.
        """
        sut = TwistedSystem()
        twistedPackage = model.Package(
            system=sut,
            name='twisted',
            docstring='ignored',
            parent=None,
            )
        twistedSubProjectPackage = model.Package(
            system=sut,
            name='subproject',
            docstring='ignored',
            parent=twistedPackage,
            )
        twistedSubProjectModule = model.Module(
            system=sut,
            name='other_child',
            docstring='ignored',
            parent=twistedSubProjectPackage,
            )
        twistedPrivateModule = model.Module(
            system=sut,
            name='_private_child',
            docstring='ignored',
            parent=twistedSubProjectPackage,
            )

        result = sut.privacyClass(twistedSubProjectPackage)
        self.assertIs(result, model.PrivacyClass.VISIBLE)

        result = sut.privacyClass(twistedSubProjectModule)
        self.assertIs(result, model.PrivacyClass.VISIBLE)

        result = sut.privacyClass(twistedPrivateModule)
        self.assertIs(result, model.PrivacyClass.PRIVATE)