Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyquery/cssselectpatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ def xpath_lt_function(self, xpath, function):
"""
if function.argument_types() != ['NUMBER']:
raise ExpressionError(
"Expected a single integer for :gt(), got %r" % (
"Expected a single integer for :lt(), got %r" % (
function.arguments,))

value = int(function.arguments[0].value)
Expand Down
5 changes: 5 additions & 0 deletions tests/test_pyquery.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,11 @@ def test_pseudo_classes(self):
self.assertEqual(e('div:lt(1)').text(), 'node1')
self.assertEqual(e('div:eq(2)').text(), 'node3')

# A non-integer :lt() argument must name :lt() in the error, not :gt().
from cssselect.xpath import ExpressionError
with self.assertRaisesRegex(ExpressionError, r':lt\('):
e('div:lt("a")')

# test on the form
e = self.klass(self.html4)
disabled = e(':disabled')
Expand Down