<s> import pickle <EOL> from nose . tools import eq_ <EOL> from . . import revision <EOL> from ... . datasources import revision_oriented <EOL> from ... . dependencies import solve <EOL> h_headings_ds = revision . datasources . heading_titles_matching ( r"<STR_LIT:h>" ) <EOL> h_headings = revision . heading_titles_matching ( r"<STR_LIT:h>" ) <EOL> lvl_2_headings_ds = revision . datasources . headings_by_level ( <NUM_LIT:2> ) <EOL> lvl_2_headings = revision . headings_by_level ( <NUM_LIT:2> ) <EOL> enwiki_wikilinks_ds = revision . datasources . wikilink_titles_matching ( r"<STR_LIT>" ) <EOL> enwiki_wikilinks = revision . wikilink_titles_matching ( r"<STR_LIT>" ) <EOL> wikimedia_external_links_ds = revision . datasources . external_link_urls_matching ( r"<STR_LIT>" ) <EOL> wikimedia_external_links = revision . external_link_urls_matching ( r"<STR_LIT>" ) <EOL> cite_templates_ds = revision . datasources . template_names_matching ( r"<STR_LIT>" ) <EOL> cite_templates = revision . template_names_matching ( r"<STR_LIT>" ) <EOL> r_text = revision_oriented . revision . text <EOL> def test_content ( ) : <EOL> cache = { r_text : "<STR_LIT>" + <EOL> "<STR_LIT>" + <EOL> "<STR_LIT>" } <EOL> eq_ ( solve ( revision . datasources . content , cache = cache ) , <EOL> "<STR_LIT>" + <EOL> "<STR_LIT>" + <EOL> "<STR_LIT>" ) <EOL> eq_ ( solve ( revision . content_chars , cache = cache ) , <NUM_LIT> ) <EOL> eq_ ( pickle . loads ( pickle . dumps ( revision . content_chars ) ) , <EOL> revision . content_chars ) <EOL> def test_headings ( ) : <EOL> cache = { r_text : "<STR_LIT>" + <EOL> "<STR_LIT>" + <EOL> "<STR_LIT>" + <EOL> "<STR_LIT>" } <EOL> eq_ ( solve ( revision . datasources . heading_titles , cache = cache ) , <EOL> [ "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> eq_ ( solve ( revision . headings , cache = cache ) , <NUM_LIT:2> ) <EOL> eq_ ( solve ( h_headings , cache = cache ) , <NUM_LIT:1> ) <EOL> eq_ ( solve ( lvl_2_headings , cache = cache ) , <NUM_LIT:1> ) <EOL> eq_ ( pickle . loads ( pickle . dumps ( revision . headings ) ) , revision . headings ) <EOL> eq_ ( pickle . loads ( pickle . dumps ( h_headings ) ) , h_headings ) <EOL> eq_ ( pickle . loads ( pickle . dumps ( lvl_2_headings ) ) , lvl_2_headings ) <EOL> def test_wikilinks ( ) : <EOL> cache = { r_text : "<STR_LIT>" + <EOL> "<STR_LIT>" + <EOL> "<STR_LIT>" + <EOL> "<STR_LIT>" } <EOL> eq_ ( solve ( revision . datasources . wikilink_titles , cache = cache ) , <EOL> [ "<STR_LIT>" , "<STR_LIT:bar>" ] ) <EOL> eq_ ( solve ( revision . wikilinks , cache = cache ) , <NUM_LIT:2> ) <EOL> eq_ ( solve ( enwiki_wikilinks , cache = cache ) , <NUM_LIT:1> ) <EOL> eq_ ( pickle . loads ( pickle . dumps ( revision . wikilinks ) ) , revision . wikilinks ) <EOL> eq_ ( pickle . loads ( pickle . dumps ( enwiki_wikilinks ) ) , enwiki_wikilinks ) <EOL> def test_external_links ( ) : <EOL> cache = { r_text : "<STR_LIT>" + <EOL> "<STR_LIT>" + <EOL> "<STR_LIT>" + <EOL> "<STR_LIT>" } <EOL> eq_ ( solve ( revision . datasources . external_link_urls , cache = cache ) , <EOL> [ "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> eq_ ( solve ( revision . external_links , cache = cache ) , <NUM_LIT:2> ) <EOL> eq_ ( solve ( wikimedia_external_links , cache = cache ) , <NUM_LIT:1> ) <EOL> eq_ ( pickle . loads ( pickle . dumps ( revision . external_links ) ) , <EOL> revision . external_links ) <EOL> eq_ ( pickle . loads ( pickle . dumps ( wikimedia_external_links ) ) , <EOL> wikimedia_external_links ) <EOL> def test_tags ( ) : <EOL> cache = { r_text : "<STR_LIT>" + <EOL> "<STR_LIT>" + <EOL> "<STR_LIT>" + <EOL> "<STR_LIT>" } <EOL> eq_ ( solve ( revision . datasources . tag_names , cache = cache ) , <EOL> [ "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> eq_ ( solve ( revision . tags , cache = cache ) , <NUM_LIT:2> ) <EOL> eq_ ( solve ( revision . ref_tags , cache = cache ) , <NUM_LIT:1> ) <EOL> eq_ ( pickle . loads ( pickle . dumps ( revision . tags ) ) , <EOL> revision . tags ) <EOL> eq_ ( pickle . loads ( pickle . dumps ( revision . ref_tags ) ) , <EOL> revision . ref_tags ) <EOL> def test_templates ( ) : <EOL> cache = { r_text : "<STR_LIT>" + <EOL> "<STR_LIT>" + <EOL> "<STR_LIT>" + <EOL> "<STR_LIT>" } <EOL> eq_ ( solve ( revision . datasources . template_names , cache = cache ) , <EOL> [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> eq_ ( solve ( revision . templates , cache = cache ) , <NUM_LIT:3> ) <EOL> eq_ ( solve ( cite_templates , cache = cache ) , <NUM_LIT:1> ) <EOL> eq_ ( pickle . loads ( pickle . dumps ( revision . templates ) ) , <EOL> revision . templates ) <EOL> eq_ ( pickle . loads ( pickle . dumps ( cite_templates ) ) , <EOL> cite_templates ) </s>
