[MRG+1] Various FormRequest tests+fixes #1597
Conversation
Current coverage is
|
Awesome, thanks! |
'|descendant::input[@type!="submit" and @type!="image" and @type!="reset"' | ||
'and ((@type!="checkbox" and @type!="radio") or @checked)]') | ||
'|descendant::input[not(@type) or @type[' | ||
' translate(., "SUBMIT", "submit") != "submit"' |
redapple
Nov 13, 2015
Contributor
lxml has support for EXSLT regex extensions:
https://stackoverflow.com/questions/2755950/how-to-use-regular-expression-in-lxml-xpath
http://exslt.org/regexp/functions/test/index.html
boolean regexp:test(string, string, 'i')
I think it would be easier to read
lxml has support for EXSLT regex extensions:
https://stackoverflow.com/questions/2755950/how-to-use-regular-expression-in-lxml-xpath
http://exslt.org/regexp/functions/test/index.html
boolean regexp:test(string, string, 'i')
I think it would be easier to read
Digenis
Nov 13, 2015
Author
Member
re:test(@type, "^(submit|image|reset)$", "i")
only for the first 3
and separately the checkbox and the radio.
Alternatively it's a regexp per value.
I didn't test it but I think there should be a performance penalty
invoking python's re module instead of leaving it to libxml.
re:test(@type, "^(submit|image|reset)$", "i")
only for the first 3
and separately the checkbox and the radio.
Alternatively it's a regexp per value.
I didn't test it but I think there should be a performance penalty
invoking python's re module instead of leaving it to libxml.
redapple
Nov 13, 2015
Contributor
" there should be a performance penalty"
probably. I'd be curious to see a comparison.
and I'd still go for the regexp version for readability
" there should be a performance penalty"
probably. I'd be curious to see a comparison.
and I'd still go for the regexp version for readability
I changed it according to @redapple's suggestion. |
@redapple what do you think about the new implementation? |
@Digenis , @kmike , FWIW, I was thinking of something like
|
Is there something left to do for this PR? |
[MRG+1] Various FormRequest tests+fixes
#1595 FormRequest should consider input type values case-insensitive
#1596 FormRequest doesn't handle input elements without type attribute
Plus: I noticed a maybe-unicode xpath wasn't encoded
when raising an exception whose
str
message is formatting it with %s.