<s> import pickle <EOL> from nose . tools import eq_ <EOL> from ... . . datasources import revision_oriented <EOL> from ... . . dependencies import solve <EOL> from . . regex_matches import RegexMatches <EOL> badwords = RegexMatches ( <EOL> "<STR_LIT>" , <EOL> [ r'<STR_LIT>' , r'<STR_LIT>' ] , <EOL> ) <EOL> r_text = revision_oriented . revision . text <EOL> p_text = revision_oriented . revision . parent . text <EOL> def test_regexes ( ) : <EOL> cache = { p_text : "<STR_LIT>" , <EOL> r_text : "<STR_LIT>" } <EOL> eq_ ( solve ( badwords . revision . datasources . matches , cache = cache ) , <EOL> [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> eq_ ( solve ( badwords . revision . matches , cache = cache ) , <NUM_LIT:3> ) <EOL> eq_ ( solve ( badwords . revision . parent . datasources . matches , cache = cache ) , <EOL> [ '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> eq_ ( solve ( badwords . revision . parent . matches , cache = cache ) , <NUM_LIT:2> ) <EOL> diff = badwords . revision . diff <EOL> eq_ ( solve ( diff . datasources . matches_added , cache = cache ) , <EOL> [ '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> eq_ ( solve ( diff . matches_added , cache = cache ) , <NUM_LIT:2> ) <EOL> eq_ ( solve ( diff . datasources . matches_removed , cache = cache ) , <EOL> [ '<STR_LIT>' ] ) <EOL> eq_ ( solve ( diff . matches_removed , cache = cache ) , <NUM_LIT:1> ) <EOL> eq_ ( solve ( diff . datasources . match_delta , cache = cache ) , <EOL> { '<STR_LIT>' : <NUM_LIT:1> , '<STR_LIT>' : <NUM_LIT:1> , '<STR_LIT>' : - <NUM_LIT:1> } ) <EOL> pd = solve ( diff . datasources . match_prop_delta , cache = cache ) <EOL> eq_ ( pd . keys ( ) , { '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' } ) <EOL> eq_ ( round ( pd [ '<STR_LIT>' ] , <NUM_LIT:2> ) , <NUM_LIT> ) <EOL> eq_ ( round ( pd [ '<STR_LIT>' ] , <NUM_LIT:2> ) , <NUM_LIT:1> ) <EOL> eq_ ( round ( pd [ '<STR_LIT>' ] , <NUM_LIT:2> ) , - <NUM_LIT:1> ) <EOL> eq_ ( round ( solve ( diff . match_delta_sum , cache = cache ) , <NUM_LIT:2> ) , <NUM_LIT:1> ) <EOL> eq_ ( round ( solve ( diff . match_prop_delta_sum , cache = cache ) , <NUM_LIT:2> ) , <NUM_LIT> ) <EOL> def test_pickling ( ) : <EOL> eq_ ( pickle . loads ( pickle . dumps ( badwords . revision . matches ) ) , <EOL> badwords . revision . matches ) <EOL> eq_ ( pickle . loads ( pickle . dumps ( badwords . revision . parent . matches ) ) , <EOL> badwords . revision . parent . matches ) <EOL> eq_ ( pickle . loads ( pickle . dumps ( badwords . revision . diff . matches_added ) ) , <EOL> badwords . revision . diff . matches_added ) <EOL> eq_ ( pickle . loads ( pickle . dumps ( badwords . revision . diff . matches_removed ) ) , <EOL> badwords . revision . diff . matches_removed ) <EOL> eq_ ( pickle . loads ( pickle . dumps ( badwords . revision . diff . matches_added ) ) , <EOL> badwords . revision . diff . matches_added ) <EOL> eq_ ( pickle . loads ( pickle . dumps ( badwords . revision . diff . matches_removed ) ) , <EOL> badwords . revision . diff . matches_removed ) </s>
