________________ 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
Description
Description
Status | Subtype | Assigned | Task | ||
---|---|---|---|---|---|
Open | None | T152961 Improve tests suite | |||
Open | None | T129368 Usages of unittest.expectedFailure or unittest.skip should be solved (goal) | |||
Open | None | T367260 Write test CI github action has ~ 22 failing tests or errors | |||
Open | None | T367327 TestWikibaseMakeClaim.test_WbTabularData_edit() of wikibase_edit_tests fails with ValueError |