Dalba created this task.
Dalba added projects: Pywikibot, Pywikibot-tests.
Restricted Application added subscribers: pywikibot-bugs-list, Aklapper.

TASK DESCRIPTION

https://travis-ci.org/wikimedia/pywikibot/jobs/448209151

__ TestWikibaseCoordinateNonDry.test_Coordinate_get_globe_item_different_repo __
self = <tests.wikibase_tests.TestWikibaseCoordinateNonDry testMethod=test_Coordinate_get_globe_item_different_repo>
    def test_Coordinate_get_globe_item_different_repo(self):
        """Test getting globe item in different repo from Coordinate."""
        repo = self.get_repo()
        test_repo = pywikibot.Site('test', 'wikidata')
        q = pywikibot.Coordinate(
            site=repo, lat=12.0, lon=13.0, precision=0,
            globe_item='http://test.wikidata.org/entity/Q123')
>       self.assertEqual(q.get_globe_item(test_repo),
                         ItemPage(test_repo, 'Q123'))
tests/wikibase_tests.py:265: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
pywikibot/__init__.py:464: in get_globe_item
    return ItemPage.from_entity_uri(repo, self.entity, lazy_load)
pywikibot/page.py:4433: in from_entity_uri
    if not lazy_load and not item.exists():
pywikibot/page.py:3859: in exists
    self.get(get_redirect=True)
pywikibot/page.py:4449: in get
    data = super(ItemPage, self).get(force, *args, **kwargs)
pywikibot/page.py:3949: in get
    c = Claim.fromJSON(self.repo, claim)
pywikibot/page.py:4886: in fromJSON
    claim.type, lambda value, site: value)(value, site)
pywikibot/page.py:4817: in <lambda>
    FilePage(pywikibot.Site('commons', 'commons'), value),  # T90492
pywikibot/tools/__init__.py:1740: in wrapper
    return obj(*__args, **__kw)
pywikibot/page.py:2423: in __init__
    super(FilePage, self).__init__(source, title, 6)
pywikibot/tools/__init__.py:1740: in wrapper
    return obj(*__args, **__kw)
pywikibot/page.py:2272: in __init__
    super(Page, self).__init__(source, title, ns)
pywikibot/page.py:196: in __init__
    self._link = Link(title, source=source, default_namespace=ns)
pywikibot/tools/__init__.py:1740: in wrapper
    return obj(*__args, **__kw)
pywikibot/page.py:5518: in __init__
    self._text = url2unicode(self._text, encodings=encodings)
pywikibot/tools/__init__.py:1740: in wrapper
    return obj(*__args, **__kw)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
title = {'altitude': None, 'globe': 'http://www.wikidata.org/entity/Q2', 'latitude': 48.9861, 'longitude': -113.622, ...}
encodings = ['utf-8', 'utf-8']
    @deprecated_args(site2=None, site='encodings')
    def url2unicode(title, encodings='utf-8'):
        """
        Convert URL-encoded text to unicode using several encoding.
    
        Uses the first encoding that doesn't cause an error.
    
        @param title: URL-encoded character data to convert
        @type title: str
        @param encodings: Encodings to attempt to use during conversion.
        @type encodings: str, list or Site
        @rtype: unicode
    
        @raise UnicodeError: Could not convert using any encoding.
        """
        if isinstance(encodings, basestring):
            encodings = [encodings]
        elif isinstance(encodings, pywikibot.site.BaseSite):
            # create a list of all possible encodings for both hint sites
            site = encodings
            encodings = [site.encoding()] + list(site.encodings())
    
        first_exception = None
        for enc in encodings:
            try:
>               t = title.encode(enc)
E               AttributeError: 'dict' object has no attribute 'encode'
pywikibot/page.py:6108: AttributeError
------------------------------ Captured log call -------------------------------
logging.py                 109 VERBOSE  Found 1 wikidata:test processes running, including this one.
______ TestWbQuantityNonDry.test_WbQuantity_get_unit_item_different_repo _______
self = <tests.wikibase_tests.TestWbQuantityNonDry testMethod=test_WbQuantity_get_unit_item_different_repo>
    def test_WbQuantity_get_unit_item_different_repo(self):
        """Test getting unit item in different repo from WbQuantity."""
        repo = self.get_repo()
        test_repo = pywikibot.Site('test', 'wikidata')
        q = pywikibot.WbQuantity(amount=1234, error=1, site=repo,
                                 unit='http://test.wikidata.org/entity/Q123')
>       self.assertEqual(q.get_unit_item(test_repo),
                         ItemPage(test_repo, 'Q123'))
tests/wikibase_tests.py:615: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
pywikibot/__init__.py:847: in get_unit_item
    self._unit = ItemPage.from_entity_uri(repo, self._unit, lazy_load)
pywikibot/page.py:4433: in from_entity_uri
    if not lazy_load and not item.exists():
pywikibot/page.py:3859: in exists
    self.get(get_redirect=True)
pywikibot/page.py:4449: in get
    data = super(ItemPage, self).get(force, *args, **kwargs)
pywikibot/page.py:3949: in get
    c = Claim.fromJSON(self.repo, claim)
pywikibot/page.py:4886: in fromJSON
    claim.type, lambda value, site: value)(value, site)
pywikibot/page.py:4817: in <lambda>
    FilePage(pywikibot.Site('commons', 'commons'), value),  # T90492
pywikibot/tools/__init__.py:1740: in wrapper
    return obj(*__args, **__kw)
pywikibot/page.py:2423: in __init__
    super(FilePage, self).__init__(source, title, 6)
pywikibot/tools/__init__.py:1740: in wrapper
    return obj(*__args, **__kw)
pywikibot/page.py:2272: in __init__
    super(Page, self).__init__(source, title, ns)
pywikibot/page.py:196: in __init__
    self._link = Link(title, source=source, default_namespace=ns)
pywikibot/tools/__init__.py:1740: in wrapper
    return obj(*__args, **__kw)
pywikibot/page.py:5518: in __init__
    self._text = url2unicode(self._text, encodings=encodings)
pywikibot/tools/__init__.py:1740: in wrapper
    return obj(*__args, **__kw)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
title = {'altitude': None, 'globe': 'http://www.wikidata.org/entity/Q2', 'latitude': 48.9861, 'longitude': -113.622, ...}
encodings = ['utf-8', 'utf-8']
    @deprecated_args(site2=None, site='encodings')
    def url2unicode(title, encodings='utf-8'):
        """
        Convert URL-encoded text to unicode using several encoding.
    
        Uses the first encoding that doesn't cause an error.
    
        @param title: URL-encoded character data to convert
        @type title: str
        @param encodings: Encodings to attempt to use during conversion.
        @type encodings: str, list or Site
        @rtype: unicode
    
        @raise UnicodeError: Could not convert using any encoding.
        """
        if isinstance(encodings, basestring):
            encodings = [encodings]
        elif isinstance(encodings, pywikibot.site.BaseSite):
            # create a list of all possible encodings for both hint sites
            site = encodings
            encodings = [site.encoding()] + list(site.encodings())
    
        first_exception = None
        for enc in encodings:
            try:
>               t = title.encode(enc)
E               AttributeError: 'dict' object has no attribute 'encode'
pywikibot/page.py:6108: AttributeError

TASK DETAIL
https://phabricator.wikimedia.org/T208303

EMAIL PREFERENCES
https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: Dalba
Cc: Aklapper, pywikibot-bugs-list, Dalba, Wenyi, Tbscho, MayS, Mdupont, JJMC89, Avicennasis, mys_721tx, jayvdb, Masti, Alchimista, Rxy
_______________________________________________
pywikibot-bugs mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikibot-bugs

Reply via email to