    Slider widget
    =============

    Load requirements::

        >>> import yafowil.loader
        >>> import yafowil.widget.slider

    Test widget::

        >>> from yafowil.base import factory

    Render no range::

        >>> widget = factory('slider', 'sliderfield')
        >>> pxml(widget())
    Extract no range::

        >>> request = {'sliderfield': ''}
        >>> data = widget.extract(request)
        >>> data
, extracted=
     at ...>

        >>> request = {'sliderfield': '5'}
        >>> data = widget.extract(request)
        >>> data
    , extracted=5 at ...>

    Render no range, preset value::

        >>> widget = factory('slider', 'sliderfield', value=3)
        >>> pxml(widget())
    Extract no range, preset value::

        >>> request = {'sliderfield': ''}
        >>> data = widget.extract(request)
        >>> data
     at ...>

        >>> request = {'sliderfield': '5'}
        >>> data = widget.extract(request)
        >>> data
    Render no range, display value::

        >>> widget = factory('slider', 'sliderfield', value=20, props={
        ...     'show_value': True,
        ...     'unit': 'Unit'})
        >>> pxml(widget())
Unit: 20
    Render range::

        >>> widget = factory('slider', 'sliderfield', props={'range': True})
        >>> pxml(widget())
    Extract range::

        >>> request = {
        ...     'sliderfield.lower': '',
        ...     'sliderfield.upper': '',
        ... }
        >>> data = widget.extract(request)
        >>> data
, extracted=[,
    ] at ...>

        >>> request = {
        ...     'sliderfield.lower': '4',
        ...     'sliderfield.upper': '6',
        ... }
        >>> data = widget.extract(request)
        >>> data
    , extracted=[4, 6] at ...>

    Render range, preset value::

        >>> widget = factory('slider', 'sliderfield', value=[2, 4], props={
        ...     'range': True})
        >>> pxml(widget())
    Extract range, preset value::

        >>> request = {
        ...     'sliderfield.lower': '',
        ...     'sliderfield.upper': '',
        ... }
        >>> data = widget.extract(request)
        >>> data
,
    ] at ...>

        >>> request = {
        ...     'sliderfield.lower': '4',
        ...     'sliderfield.upper': '6',
        ... }
        >>> data = widget.extract(request)
        >>> data
    Render with all options::

        >>> widget = factory('slider', 'sliderfield', value=[2, 4], props={
        ...     'show_value': True,
        ...     'unit': 'Kg',
        ...     'orientation': 'vertical',
        ...     'height': 120,
        ...     'range': True,
        ...     'min': 1,
        ...     'max': 50,
        ...     'step': 5,
        ...     'slide': 'some_ns.some_callback',
        ...     'change': 'some_ns.some_callback',
        ...     'data': {'mydata': 1}
        ... })
        >>> widget()
        u'
Kg: 2 - 4
    '

    Render display mode, fails::

        >>> widget = factory('slider', 'sliderfield', mode='display')
        >>> widget()
        Traceback (most recent call last):
          ...
        NotImplementedError: ``yafowil.widget.slider`` does not support display
        mode yet

    Render reserved data attribute, fails::

        >>> widget = factory('slider', 'sliderfield', props={
        ...     'data': {'min': 1}
        ... })
        >>> widget()
        Traceback (most recent call last):
          ...
        ValueError: Additional data dict contains reserved attribute name 'min'