Hello community, here is the log from the commit of package python3-pyquery for openSUSE:Factory checked in at 2016-11-02 12:46:13 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python3-pyquery (Old) and /work/SRC/openSUSE:Factory/.python3-pyquery.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "python3-pyquery" Changes: -------- --- /work/SRC/openSUSE:Factory/python3-pyquery/python3-pyquery.changes 2016-05-25 21:25:43.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.python3-pyquery.new/python3-pyquery.changes 2016-11-02 12:46:16.000000000 +0100 @@ -1,0 +2,22 @@ +Tue Oct 25 17:14:25 UTC 2016 - arun@gmx.de + +- update to version 1.2.17: + * PyQuery('<input value="">').val() is '' + * PyQuery('<input>').val() is '' + +- changes from version 1.2.16: + * .attr('value', '') no longer removes the value attribute + * <input type="checkbox"> without value="..." have a .val() of 'on' + * <input type="radio"> without value="..." have a .val() of 'on' + * <select> without <option selected> have the value of their first + <option> (or None if there are no options) + +- changes from version 1.2.15: + * .val() should never raise + * drop py26 support + * improve .extend() by returning self + +- changes from version 1.2.14: + * fix val() for <textarea> and <select>, to match jQuery behavior + +------------------------------------------------------------------- @@ -7 +28,0 @@ - Old: ---- pyquery-1.2.13.tar.gz New: ---- pyquery-1.2.17.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python3-pyquery.spec ++++++ --- /var/tmp/diff_new_pack.ffaXlU/_old 2016-11-02 12:46:18.000000000 +0100 +++ /var/tmp/diff_new_pack.ffaXlU/_new 2016-11-02 12:46:18.000000000 +0100 @@ -17,7 +17,7 @@ Name: python3-pyquery -Version: 1.2.13 +Version: 1.2.17 Release: 0 Summary: A jQuery-like library for python License: BSD-3-Clause ++++++ pyquery-1.2.13.tar.gz -> pyquery-1.2.17.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyquery-1.2.13/CHANGES.rst new/pyquery-1.2.17/CHANGES.rst --- old/pyquery-1.2.13/CHANGES.rst 2016-04-12 18:02:16.000000000 +0200 +++ new/pyquery-1.2.17/CHANGES.rst 2016-10-14 23:58:07.000000000 +0200 @@ -1,3 +1,41 @@ +1.2.17 (2016-10-14) +------------------- + +- ``PyQuery('<input value="">').val()`` is ``''`` +- ``PyQuery('<input>').val()`` is ``''`` + + +1.2.16 (2016-10-14) +------------------- + +- ``.attr('value', '')`` no longer removes the ``value`` attribute + +- ``<input type="checkbox">`` without ``value="..."`` have a ``.val()`` of + ``'on'`` + +- ``<input type="radio">`` without ``value="..."`` have a ``.val()`` of + ``'on'`` + +- ``<select>`` without ``<option selected>`` have the value of their first + ``<option>`` (or ``None`` if there are no options) + + +1.2.15 (2016-10-11) +------------------- + +- .val() should never raise + +- drop py26 support + +- improve .extend() by returning self + + +1.2.14 (2016-10-10) +------------------- + +- fix val() for <textarea> and <select>, to match jQuery behavior + + 1.2.13 (2016-04-12) ------------------- @@ -23,7 +61,7 @@ 1.2.10 (2016-01-05) ------------------- -- Fixed #118: implemented usage `lxml.etree.tostring` within `outer_html` method +- Fixed #118: implemented usage ``lxml.etree.tostring`` within ``outer_html`` method - Fixed #117: Raise HTTP Error if HTTP status code is not equal to 200 @@ -129,7 +167,7 @@ 1.2 --- -- PyQuery now use `cssselect http://pypi.python.org/pypi/cssselect`_. See issue 43. +- PyQuery now uses `cssselect http://pypi.python.org/pypi/cssselect`_. See issue 43. - Fix issue 40: forward .html() extra arguments to ``lxml.etree.tostring`` diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyquery-1.2.13/PKG-INFO new/pyquery-1.2.17/PKG-INFO --- old/pyquery-1.2.13/PKG-INFO 2016-04-12 18:02:17.000000000 +0200 +++ new/pyquery-1.2.17/PKG-INFO 2016-10-14 23:58:07.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: pyquery -Version: 1.2.13 +Version: 1.2.17 Summary: A jquery-like library for python Home-page: https://github.com/gawel/pyquery Author: Gael Pasgrimaud @@ -10,6 +10,10 @@ pyquery: a jquery-like library for python ========================================= + .. image:: https://travis-ci.org/gawel/pyquery.svg + :alt: Build Status + :target: https://travis-ci.org/gawel/pyquery + pyquery allows you to make jquery queries on xml documents. The API is as much as possible the similar to jquery. pyquery uses lxml for fast xml and html manipulation. @@ -73,6 +77,44 @@ News ==== + 1.2.17 (2016-10-14) + ------------------- + + - ``PyQuery('<input value="">').val()`` is ``''`` + - ``PyQuery('<input>').val()`` is ``''`` + + + 1.2.16 (2016-10-14) + ------------------- + + - ``.attr('value', '')`` no longer removes the ``value`` attribute + + - ``<input type="checkbox">`` without ``value="..."`` have a ``.val()`` of + ``'on'`` + + - ``<input type="radio">`` without ``value="..."`` have a ``.val()`` of + ``'on'`` + + - ``<select>`` without ``<option selected>`` have the value of their first + ``<option>`` (or ``None`` if there are no options) + + + 1.2.15 (2016-10-11) + ------------------- + + - .val() should never raise + + - drop py26 support + + - improve .extend() by returning self + + + 1.2.14 (2016-10-10) + ------------------- + + - fix val() for <textarea> and <select>, to match jQuery behavior + + 1.2.13 (2016-04-12) ------------------- @@ -98,7 +140,7 @@ 1.2.10 (2016-01-05) ------------------- - - Fixed #118: implemented usage `lxml.etree.tostring` within `outer_html` method + - Fixed #118: implemented usage ``lxml.etree.tostring`` within ``outer_html`` method - Fixed #117: Raise HTTP Error if HTTP status code is not equal to 200 @@ -204,7 +246,7 @@ 1.2 --- - - PyQuery now use `cssselect http://pypi.python.org/pypi/cssselect`_. See issue 43. + - PyQuery now uses `cssselect http://pypi.python.org/pypi/cssselect`_. See issue 43. - Fix issue 40: forward .html() extra arguments to ``lxml.etree.tostring`` @@ -262,8 +304,6 @@ Platform: UNKNOWN Classifier: Intended Audience :: Developers Classifier: Development Status :: 5 - Production/Stable -Classifier: Programming Language :: Python :: 2 -Classifier: Programming Language :: Python :: 2.6 Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3.3 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyquery-1.2.13/README.rst new/pyquery-1.2.17/README.rst --- old/pyquery-1.2.13/README.rst 2016-04-12 18:02:16.000000000 +0200 +++ new/pyquery-1.2.17/README.rst 2016-10-14 23:58:07.000000000 +0200 @@ -1,6 +1,10 @@ pyquery: a jquery-like library for python ========================================= +.. image:: https://travis-ci.org/gawel/pyquery.svg + :alt: Build Status + :target: https://travis-ci.org/gawel/pyquery + pyquery allows you to make jquery queries on xml documents. The API is as much as possible the similar to jquery. pyquery uses lxml for fast xml and html manipulation. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyquery-1.2.13/pyquery/cssselectpatch.py new/pyquery-1.2.17/pyquery/cssselectpatch.py --- old/pyquery-1.2.13/pyquery/cssselectpatch.py 2016-04-12 18:02:16.000000000 +0200 +++ new/pyquery-1.2.17/pyquery/cssselectpatch.py 2016-10-14 23:58:07.000000000 +0200 @@ -439,7 +439,7 @@ """ if function.argument_types() not in (['STRING'], ['IDENT']): raise ExpressionError( - "Expected a single string or ident for :contains(), got %r" % ( + "Expected a single string or ident for :has(), got %r" % ( function.arguments,)) value = self.css_to_xpath( function.arguments[0].value, prefix='descendant::', diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyquery-1.2.13/pyquery/pyquery.py new/pyquery-1.2.17/pyquery/pyquery.py --- old/pyquery-1.2.13/pyquery/pyquery.py 2016-04-12 18:02:16.000000000 +0200 +++ new/pyquery-1.2.17/pyquery/pyquery.py 2016-10-14 23:58:07.000000000 +0200 @@ -281,6 +281,7 @@ """Extend with anoter PyQuery object""" assert isinstance(other, self.__class__) self._extend(other[:]) + return self def items(self, selector=None): """Iter over elements. Return PyQuery objects: @@ -768,7 +769,7 @@ tag.set(key, value) elif value is no_default: return self[0].get(attr) - elif value is None or value == '': + elif value is None: return self.remove_attr(attr) else: for tag in self: @@ -965,7 +966,52 @@ 'Youhou' """ - return self.attr('value', value) or None + def _get_value(tag): + # <textarea> + if tag.tag == 'textarea': + return self._copy(tag).text() + # <select> + elif tag.tag == 'select': + selected_option = self._copy(tag)('option[selected]:last') + if selected_option: + return selected_option.attr('value') + else: + return self._copy(tag)('option').attr('value') + # <input type="checkbox"> or <input type="radio"> + elif self.is_(':checkbox,:radio'): + val = self._copy(tag).attr('value') + if val is None: + return 'on' + else: + return val + # <input> and everything else. + return self._copy(tag).attr('value') or '' + + def _set_value(pq, value): + for tag in pq: + # <textarea> + if tag.tag == 'textarea': + self._copy(tag).text(value) + continue + # <select> + if tag.tag == 'select': + def _make_option_selected(_, elem): + pq = self._copy(elem) + if pq.attr('value') == value: + pq.attr('selected', 'selected') + else: + pq.removeAttr('selected') + self._copy(tag)('option').each(_make_option_selected) + continue + # <input> and everything else. + self._copy(tag).attr('value', value) + + if value is no_default: + if len(self): + return _get_value(self[0]) + else: + _set_value(self, value) + return self def html(self, value=no_default, **kwargs): """Get or set the html representation of sub nodes. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyquery-1.2.13/pyquery.egg-info/PKG-INFO new/pyquery-1.2.17/pyquery.egg-info/PKG-INFO --- old/pyquery-1.2.13/pyquery.egg-info/PKG-INFO 2016-04-12 18:02:17.000000000 +0200 +++ new/pyquery-1.2.17/pyquery.egg-info/PKG-INFO 2016-10-14 23:58:07.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: pyquery -Version: 1.2.13 +Version: 1.2.17 Summary: A jquery-like library for python Home-page: https://github.com/gawel/pyquery Author: Gael Pasgrimaud @@ -10,6 +10,10 @@ pyquery: a jquery-like library for python ========================================= + .. image:: https://travis-ci.org/gawel/pyquery.svg + :alt: Build Status + :target: https://travis-ci.org/gawel/pyquery + pyquery allows you to make jquery queries on xml documents. The API is as much as possible the similar to jquery. pyquery uses lxml for fast xml and html manipulation. @@ -73,6 +77,44 @@ News ==== + 1.2.17 (2016-10-14) + ------------------- + + - ``PyQuery('<input value="">').val()`` is ``''`` + - ``PyQuery('<input>').val()`` is ``''`` + + + 1.2.16 (2016-10-14) + ------------------- + + - ``.attr('value', '')`` no longer removes the ``value`` attribute + + - ``<input type="checkbox">`` without ``value="..."`` have a ``.val()`` of + ``'on'`` + + - ``<input type="radio">`` without ``value="..."`` have a ``.val()`` of + ``'on'`` + + - ``<select>`` without ``<option selected>`` have the value of their first + ``<option>`` (or ``None`` if there are no options) + + + 1.2.15 (2016-10-11) + ------------------- + + - .val() should never raise + + - drop py26 support + + - improve .extend() by returning self + + + 1.2.14 (2016-10-10) + ------------------- + + - fix val() for <textarea> and <select>, to match jQuery behavior + + 1.2.13 (2016-04-12) ------------------- @@ -98,7 +140,7 @@ 1.2.10 (2016-01-05) ------------------- - - Fixed #118: implemented usage `lxml.etree.tostring` within `outer_html` method + - Fixed #118: implemented usage ``lxml.etree.tostring`` within ``outer_html`` method - Fixed #117: Raise HTTP Error if HTTP status code is not equal to 200 @@ -204,7 +246,7 @@ 1.2 --- - - PyQuery now use `cssselect http://pypi.python.org/pypi/cssselect`_. See issue 43. + - PyQuery now uses `cssselect http://pypi.python.org/pypi/cssselect`_. See issue 43. - Fix issue 40: forward .html() extra arguments to ``lxml.etree.tostring`` @@ -262,8 +304,6 @@ Platform: UNKNOWN Classifier: Intended Audience :: Developers Classifier: Development Status :: 5 - Production/Stable -Classifier: Programming Language :: Python :: 2 -Classifier: Programming Language :: Python :: 2.6 Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3.3 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyquery-1.2.13/setup.cfg new/pyquery-1.2.17/setup.cfg --- old/pyquery-1.2.13/setup.cfg 2016-04-12 18:02:17.000000000 +0200 +++ new/pyquery-1.2.17/setup.cfg 2016-10-14 23:58:07.000000000 +0200 @@ -9,6 +9,9 @@ with-coverage = 1 doctest-options = +ELLIPSIS,+NORMALIZE_WHITESPACE +[bdist_wheel] +universal = 1 + [egg_info] tag_build = tag_date = 0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyquery-1.2.13/setup.py new/pyquery-1.2.17/setup.py --- old/pyquery-1.2.13/setup.py 2016-04-12 18:02:16.000000000 +0200 +++ new/pyquery-1.2.17/setup.py 2016-10-14 23:58:07.000000000 +0200 @@ -40,7 +40,7 @@ """ % read('README', 'CHANGES') -version = '1.2.13' +version = '1.2.17' setup(name='pyquery', version=version, @@ -49,8 +49,6 @@ classifiers=[ "Intended Audience :: Developers", "Development Status :: 5 - Production/Stable", - "Programming Language :: Python :: 2", - "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyquery-1.2.13/tests/test_pyquery.py new/pyquery-1.2.17/tests/test_pyquery.py --- old/pyquery-1.2.13/tests/test_pyquery.py 2016-04-12 18:02:16.000000000 +0200 +++ new/pyquery-1.2.17/tests/test_pyquery.py 2016-10-14 23:58:07.000000000 +0200 @@ -392,6 +392,44 @@ </div> ''' + html2 = ''' + <input name="spam" value="Spam"> + <input name="eggs" value="Eggs"> + <input type="checkbox" value="Bacon"> + <input type="radio" value="Ham"> + ''' + + html3 = ''' + <textarea>Spam</textarea> + ''' + + html4 = ''' + <select id="first"> + <option value="spam">Spam</option> + <option value="eggs">Eggs</option> + </select> + <select id="second"> + <option value="spam">Spam</option> + <option value="eggs" selected>Eggs</option> + <option value="bacon">Bacon</option> + </select> + <select id="third"> + </select> + ''' + + html5 = ''' + <div> + <input id="first" value="spam"> + <input id="second" value="eggs"> + <textarea id="third">bacon</textarea> + </div> + ''' + + def test_attr_empty_string(self): + d = pq('<div>') + d.attr('value', '') + self.assertEqual(d.outer_html(), '<div value=""/>') + def test_remove(self): d = pq(self.html) d('img').remove() @@ -405,6 +443,73 @@ d.removeClass('xx') assert 'class' not in str(d), str(d) + def test_val_for_inputs(self): + d = pq(self.html2) + self.assertIsNone(d('input[name="none"]').val()) + self.assertEqual(d('input[name="spam"]').val(), 'Spam') + self.assertEqual(d('input[name="eggs"]').val(), 'Eggs') + self.assertEqual(d('input:checkbox').val(), 'Bacon') + self.assertEqual(d('input:radio').val(), 'Ham') + d('input[name="spam"]').val('42') + d('input[name="eggs"]').val('43') + d('input:checkbox').val('44') + d('input:radio').val('45') + self.assertEqual(d('input[name="spam"]').val(), '42') + self.assertEqual(d('input[name="eggs"]').val(), '43') + self.assertEqual(d('input:checkbox').val(), '44') + self.assertEqual(d('input:radio').val(), '45') + + def test_val_for_textarea(self): + d = pq(self.html3) + self.assertEqual(d('textarea').val(), 'Spam') + self.assertEqual(d('textarea').text(), 'Spam') + d('textarea').val('42') + self.assertEqual(d('textarea').val(), '42') + # Note: jQuery still returns 'Spam' here. + self.assertEqual(d('textarea').text(), '42') + + def test_val_for_select(self): + d = pq(self.html4) + self.assertEqual(d('#first').val(), 'spam') + self.assertEqual(d('#second').val(), 'eggs') + self.assertIsNone(d('#third').val()) + d('#first').val('eggs') + d('#second').val('bacon') + d('#third').val('eggs') # Selecting non-existing option. + self.assertEqual(d('#first').val(), 'eggs') + self.assertEqual(d('#second').val(), 'bacon') + self.assertIsNone(d('#third').val()) + d('#first').val('bacon') # Selecting non-existing option. + self.assertEqual(d('#first').val(), 'spam') + + def test_val_for_multiple_elements(self): + d = pq(self.html5) + # "Get" returns *first* value. + self.assertEqual(d('div > *').val(), 'spam') + # "Set" updates *every* value. + d('div > *').val('42') + self.assertEqual(d('#first').val(), '42') + self.assertEqual(d('#second').val(), '42') + self.assertEqual(d('#third').val(), '42') + + def test_val_checkbox_no_value_attribute(self): + d = pq('<input type="checkbox">') + self.assertEqual(d.val(), 'on') + d = pq('<input type="checkbox" value="">') + self.assertEqual(d.val(), '') + + def test_val_radio_no_value_attribute(self): + d = pq('<input type="radio">') + self.assertEqual(d.val(), 'on') + + def test_val_value_is_empty_string(self): + d = pq('<input value="">') + self.assertEqual(d.val(), '') + + def test_val_input_has_no_value_attr(self): + d = pq('<input>') + self.assertEqual(d.val(), '') + class TestMakeLinks(TestCase): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyquery-1.2.13/tox.ini new/pyquery-1.2.17/tox.ini --- old/pyquery-1.2.13/tox.ini 2016-04-12 18:02:16.000000000 +0200 +++ new/pyquery-1.2.17/tox.ini 2016-10-14 23:58:07.000000000 +0200 @@ -1,5 +1,5 @@ [tox] -envlist=py26,py27,py33,py34,py35 +envlist=py27,py33,py34,py35 [testenv] whitelist_externals= @@ -8,8 +8,6 @@ rm -f .coverage {envbindir}/nosetests [] deps = - py26: unittest2 - py26: restkit py27: unittest2 py27: restkit requests