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

TASK DESCRIPTION
    ________________ TestWikibaseMakeClaim.test_WbTabularData_edit 
_________________
    
    self = <tests.wikibase_edit_tests.TestWikibaseMakeClaim 
testMethod=test_WbTabularData_edit>
    
        def test_WbTabularData_edit(self):
            """Attempt adding a tabular-data with valid input."""
            # Clean the slate in preparation for test.
            testsite = self.get_repo()
            item = self._clean_item(testsite, 'P30175')
        
            # set new claim
            claim = pywikibot.page.Claim(
                testsite, 'P30175', datatype='tabular-data')
            commons_site = pywikibot.Site('commons')
            page = pywikibot.Page(commons_site, 'Data:Bea.gov/GDP by state.tab')
    >       target = pywikibot.WbGeoShape(page)
    
    tests/wikibase_edit_tests.py:407: 
    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
_ _ 
    pywikibot/_wbtypes.py:1062: in __init__
        specifics['label'])
    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
_ _ 
    
    page = Page('Data:Bea.gov/GDP by state.tab')
    data_site = DataSite("commons", "commons"), ending = '.map', label = 
'geo-shape'
    
        @staticmethod
        def _validate(page: pywikibot.Page, data_site: BaseSite, ending: str,
                      label: str) -> None:
            """
            Validate the provided page against general and type specific rules.
        
            :param page: Page containing the data.
            :param data_site: The site serving as a repository for the given
                data type.
            :param ending: Required filetype-like ending in page titles.
                E.g. '.map'
            :param label: Label describing the data type in error messages.
            """
            if not isinstance(page, pywikibot.Page):
                raise ValueError(f'Page {page} must be a pywikibot.Page object '
                                 f'not a {type(page)}.')
        
            # validate page exists
            if not page.exists():
                raise ValueError(f'Page {page} must exist.')
        
            # validate page is on the right site, and that site supports the 
type
            if not data_site:
                raise ValueError(
                    f'The provided site does not support {label}.')
            if page.site != data_site:
                raise ValueError(
                    f'Page must be on the {label} repository site.')
        
            # validate page title fulfills hard-coded Wikibase requirement
            # pcre regexp: '/^Data:[^\\[\\]#\\\:{|}]+\.map$/u' for geo-shape
            # pcre regexp: '/^Data:[^\\[\\]#\\\:{|}]+\.tab$/u' for tabular-data
            # As we have already checked for existence the following simplified
            # check should be enough.
            if not page.title().startswith('Data:') \
               or not page.title().endswith(ending):
                raise ValueError(
                    "Page must be in 'Data:' namespace and end in '{}' "
    >               'for {}.'.format(ending, label))
    E           ValueError: Page must be in 'Data:' namespace and end in '.map' 
for geo-shape.
    
    pywikibot/_wbtypes.py:1049: ValueError

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

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

To: Xqt
Cc: Lokal_Profil, Aklapper, Xqt, pywikibot-bugs-list, mevo, PotsdamLamb, 
Jyoo1011, JohnsonLee01, SHEKH, Dijkstra, Khutuck, Zkhalido, Aram, Viztor, 
Wenyi, Tbscho, MayS, Mdupont, JJMC89, Dvorapa, Altostratus, binbot, 
Avicennasis, mys_721tx, jayvdb, Masti, Alchimista
_______________________________________________
pywikibot-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to