Commit b6c6ed23 authored by Laurent Bachelier's avatar Laurent Bachelier 🐧

Fix filters doctests and add them to the usual test run

parent d19e0637
......@@ -7,4 +7,5 @@ tests = weboob.capabilities.bank,
weboob.tools.capabilities.paste,
weboob.tools.application.formatters.json,
weboob.tools.application.formatters.table,
weboob.tools.path
weboob.tools.path,
weboob.tools.browser2.filters.standard
......@@ -129,7 +129,7 @@ class _Selector(Filter):
class Base(Filter):
"""
Change the base element used in filters.
>>> Base(Env('header'), CleanText('./h1'))
>>> Base(Env('header'), CleanText('./h1')) # doctest: +SKIP
"""
def __call__(self, item):
base = self.select(self.base, item)
......@@ -163,7 +163,7 @@ class TableCell(_Filter):
For example:
>>> from weboob.capabilities.bank import Transaction
>>> from .page import TableElement, ItemElement
>>> from weboob.tools.browser2.elements import TableElement, ItemElement
>>> class table(TableElement):
... head_xpath = '//table/thead/th'
... item_xpath = '//table/tbody/tr'
......@@ -221,6 +221,11 @@ class CleanText(Filter):
It first replaces all tabs and multiple spaces to one space and strip the result
string.
Second, it replaces all symbols given in second argument.
>>> CleanText().filter('coucou ')
u'coucou'
>>> CleanText().filter(u'coucou\xc2\xa0\t\\ncoucou')
u'coucou coucou'
"""
def __init__(self, selector=None, symbols='', replace=[], childs=True, **kwargs):
......@@ -280,7 +285,7 @@ class CleanDecimal(CleanText):
For example, for the UK style (as in 1,234,567.89):
>>> CleanDecimal('./td[1]', replace_dots=(',', '.'))
>>> CleanDecimal('./td[1]', replace_dots=(',', '.')) # doctest: +SKIP
"""
def __init__(self, selector=None, replace_dots=True, default=_NO_DEFAULT):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment