コード例 #1
0
ファイル: collections.py プロジェクト: zuphilip/coala
    def __contains__(self, aspect):
        # Check if ``aspects`` language is supported.
        if self.languages is not None and isinstance(aspect, aspectbase):
            if aspect.language not in self.languages:
                return False

        for item in self:
            if issubaspect(aspect, item):
                return aspect not in self.exclude
        return False
コード例 #2
0
ファイル: SectionTest.py プロジェクト: Anmolbansal1/coala
    def test_extract_aspects_from_section_with_exclude(self):
        section = Section('section')
        section.append(Setting('aspects', 'commitmessage'))
        section.append(Setting('excludes', 'TrailingPeriod'))
        section.language = Language['py 3.4']

        aspects = extract_aspects_from_section(section)

        self.assertTrue(issubaspect(get_aspect('trailingperiod'),
                                    get_aspect('commitmessage')))
        self.assertIsNone(aspects.get('trailingperiod'))
コード例 #3
0
ファイル: SectionTest.py プロジェクト: mani87/coala
    def test_extract_aspects_from_section_with_exclude(self):
        section = Section('section')
        section.append(Setting('aspects', 'commitmessage'))
        section.append(Setting('excludes', 'TrailingPeriod'))
        section.append(Setting('language', 'py 3.4'))

        aspects = extract_aspects_from_section(section)

        self.assertTrue(
            issubaspect(get_aspect('trailingperiod'),
                        get_aspect('commitmessage')))
        self.assertIsNone(aspects.get('trailingperiod'))
コード例 #4
0
ファイル: ClassTest.py プロジェクト: saurabhraj1896/coala
    def test_issubaspect(self, RootAspect):
        @RootAspect.subaspect
        class SubAspect:
            """
            Description
            """

        assert issubaspect(SubAspect, RootAspect)
        assert not issubaspect(Root, RootAspect)
        assert issubaspect(RootAspect, RootAspect)
        with pytest.raises(TypeError) as exc:
            issubaspect('String', SubAspect)
        assert (str(exc.value) == "'String' is not an aspectclass or "
                'an instance of an aspectclass')
        with pytest.raises(TypeError) as exc:
            issubaspect(RootAspect, str)
        assert (str(exc.value) == "<class 'str'> is not an aspectclass or "
                'an instance of an aspectclass')
        assert issubaspect(SubAspect('Python'), RootAspect)
コード例 #5
0
ファイル: ClassTest.py プロジェクト: arush0311/coala
    def test_issubaspect(self, RootAspect):
        @RootAspect.subaspect
        class SubAspect:
            """
            Description
            """

        assert issubaspect(SubAspect, RootAspect)
        assert not issubaspect(Root, RootAspect)
        assert issubaspect(RootAspect, RootAspect)
        with pytest.raises(TypeError) as exc:
            issubaspect('String', SubAspect)
        assert (str(exc.value) == "'String' is not an aspectclass or "
                'an instance of an aspectclass')
        with pytest.raises(TypeError) as exc:
            issubaspect(RootAspect, str)
        assert (str(exc.value) == "<class 'str'> is not an aspectclass or "
                'an instance of an aspectclass')
        assert issubaspect(SubAspect('Python'), RootAspect)
コード例 #6
0
ファイル: collections.py プロジェクト: solutionfinders/coala
 def __contains__(self, aspect):
     for item in self:
         if issubaspect(aspect, item):
             return aspect not in self.exclude
     return False
コード例 #7
0
 def __contains__(self, aspect):
     for item in self:
         if issubaspect(aspect, item):
             return True
     return False
コード例 #8
0
ファイル: collections.py プロジェクト: netman92/coala
 def __contains__(self, aspect):
     for item in self:
         if issubaspect(aspect, item):
             return True
     return False