This commit is contained in:
Kovid Goyal 2017-01-20 08:09:36 +05:30
parent 233817b48f
commit 8b79484d3a
4 changed files with 8 additions and 4 deletions

View File

@ -1410,7 +1410,7 @@ if __name__ == '__main__': # tests {{{
] # }}} ] # }}}
ca_tests = [ # {{{ ca_tests = [ # {{{
( # Paperback with series ( # Paperback with series
{'identifiers':{'isbn':'9781623808747'}}, {'identifiers':{'isbn':'9781623808747'}},
[title_test('Parting Shot', exact=True), authors_test(['Mary Calmes'])] [title_test('Parting Shot', exact=True), authors_test(['Mary Calmes'])]
), ),
@ -1434,8 +1434,7 @@ if __name__ == '__main__': # tests {{{
test_identify_plugin(Amazon.name, tests, modify_plugin=lambda test_identify_plugin(Amazon.name, tests, modify_plugin=lambda
p:(setattr(p, 'testing_domain', domain), setattr(p, 'touched_fields', p.touched_fields - {'tags'}))) p:(setattr(p, 'testing_domain', domain), setattr(p, 'touched_fields', p.touched_fields - {'tags'})))
#do_test('com') do_test('com')
do_test('ca')
# do_test('de') # do_test('de')
# }}} # }}}

View File

@ -541,6 +541,8 @@ class NoNamespaceTreeBuilder(TreeBuilder):
body.set(to_xml_name(k), v) body.set(to_xml_name(k), v)
# Input Stream {{{ # Input Stream {{{
_regex_cache = {} _regex_cache = {}
@ -604,6 +606,7 @@ class FastStream(object):
return (lnum + 1, offset) return (lnum + 1, offset)
# }}} # }}}
if len("\U0010FFFF") == 1: # UCS4 build if len("\U0010FFFF") == 1: # UCS4 build
replace_chars = re.compile("[\uD800-\uDFFF]") replace_chars = re.compile("[\uD800-\uDFFF]")
else: else:
@ -689,9 +692,9 @@ def parse(raw, decoder=None, log=None, line_numbers=True, linenumber_attribute=N
log.exception('Failed to parse as XML, parsing as tag soup') log.exception('Failed to parse as XML, parsing as tag soup')
return parse_html5(raw, log=log, line_numbers=line_numbers, linenumber_attribute=linenumber_attribute, replace_entities=False, fix_newlines=False) return parse_html5(raw, log=log, line_numbers=line_numbers, linenumber_attribute=linenumber_attribute, replace_entities=False, fix_newlines=False)
if __name__ == '__main__': if __name__ == '__main__':
from lxml import etree from lxml import etree
root = parse_html5('\n<html><head><title>a\n</title><p b=1 c=2 a=0>&nbsp;\n<b>b<svg ass="wipe" viewbox="0">', discard_namespaces=False) root = parse_html5('\n<html><head><title>a\n</title><p b=1 c=2 a=0>&nbsp;\n<b>b<svg ass="wipe" viewbox="0">', discard_namespaces=False)
print (etree.tostring(root, encoding='utf-8')) print (etree.tostring(root, encoding='utf-8'))
print() print()

View File

@ -664,6 +664,7 @@ class EchoLine(Connection): # {{{
self.rbuf.seek(pos + sent) self.rbuf.seek(pos + sent)
# }}} # }}}
if __name__ == '__main__': if __name__ == '__main__':
s = ServerLoop(EchoLine) s = ServerLoop(EchoLine)
with HandleInterrupt(s.wakeup): with HandleInterrupt(s.wakeup):

View File

@ -525,6 +525,7 @@ def remove_dir_if_empty(path, ignore_metadata_caches=False):
return return
raise raise
if iswindows: if iswindows:
# Python's expanduser is broken for non-ASCII usernames # Python's expanduser is broken for non-ASCII usernames
def expanduser(path): def expanduser(path):