예제 #1
0
def test_example_1():
    a = authors.get_authors(example_1)
    print a
    assert a == [
        u'CosmicPenguin', u'Denelson83', u'Kwanesum', u'Nationalparks',
        u'Palaeozoic99', u'Qyd', u'Skookum1', u'The Tom', 'ANONIPEDITS:0'
    ]
예제 #2
0
def test_example_1():
    a = authors.get_authors(example_1)
    print a
    assert a == [
        u"CosmicPenguin",
        u"Denelson83",
        u"Kwanesum",
        u"Nationalparks",
        u"Palaeozoic99",
        u"Qyd",
        u"Skookum1",
        u"The Tom",
        "ANONIPEDITS:0",
    ]
예제 #3
0
파일: nuwiki.py 프로젝트: ingob/mwlib
    def getAuthors(self, title, revision=None):
        from mwlib.authors import get_authors
        
        if self.edits is None:
            edits = self.edits = {}
            for edit in self.nuwiki.get_data("edits") or []:
                try:
                    edits[edit['title']] = edit.get("revisions")
                except KeyError:
                    continue

        fqname = self.nshandler.get_fqname(title)
        fqname = self.redirects.get(fqname, fqname)
        revisions = self.edits.get(fqname, [])
        authors = get_authors(revisions)
        return authors
예제 #4
0
    def _getAuthors(self, title, fqname, revision=None):
        if getattr(self.nuwiki, 'authors', None) is not None:
            authors = self.nuwiki.authors[fqname]
            return authors
        else:
            from mwlib.authors import get_authors
            if self.edits is None:
                edits = self.edits = {}
                for edit in self.nuwiki.get_data("edits") or []:
                    try:
                        edits[edit['title']] = edit.get("revisions")
                    except KeyError:
                        continue

            revisions = self.edits.get(fqname, [])
            authors = get_authors(revisions)

            return authors
예제 #5
0
def test_empty():
    assert authors.get_authors([]) == []
예제 #6
0
def test_empty():
    assert authors.get_authors([]) == []
예제 #7
0
def test_example_1():
    a = authors.get_authors(example_1)
    print a
    assert a == [u'CosmicPenguin', u'Denelson83', u'Kwanesum', u'Nationalparks',
                 u'Palaeozoic99', u'Qyd', u'Skookum1', u'The Tom', 'ANONIPEDITS:0']