Package lxml :: Package html :: Package tests :: Module transform_feedparser_data
[hide private]
[frames] | no frames]

Module transform_feedparser_data

source code


This takes the feedparser tests from here:

  http://feedparser.org/tests/wellformed/sanitize/

and rewrites them to be easier to handle (not using the internal model
of feedparser).  The input format is::

  <!--
  Description: {description}
  Expect: {expression}
  -->
  ...
  <content ...>{content}</content>
  ...

The Expect expression is checked for
``entries[0]['content'][0]['value'] == {data}``.

The output format is::

  Description: {description}
  Expect: {expression} (if data couldn't be parsed)
  Options: 

  {content, unescaped}
  ----------
  {data, unescaped, if found}



Functions [hide private]
 
parse_content(content) source code
 
serialize_content(d) source code
 
translate_file(filename) source code
 
translate_all(dir) source code
Variables [hide private]
  _desc_re = re.compile(r'\s*Description:\s*(.*)')
  _expect_re = re.compile(r'\s*Expect:\s*(.*)')
  _data_expect_re = re.compile(r'entries\[0\]\[\'[^\']+\'\](?:\[...
  _feed_data_expect_re = re.compile(r'feed\[\'[^\']+\'\]\s*==\s*...
Variables Details [hide private]

_data_expect_re

Value:
re.compile(r'entries\[0\]\[\'[^\']+\'\](?:\[0\]\[\'value\'\])?\s*==\s*\
(.*)')

_feed_data_expect_re

Value:
re.compile(r'feed\[\'[^\']+\'\]\s*==\s*(.*)')