<s> """<STR_LIT>""" <EOL> from nose . tools import * <EOL> from dssg . machine import Machine <EOL> def setup ( ) : <EOL> print "<STR_LIT>" <EOL> def teardown ( ) : <EOL> print "<STR_LIT>" <EOL> def test_canExtractUrls ( ) : <EOL> text = "<STR_LIT>" <EOL> extract_fn = Machine . _extract_urls <EOL> expected = [ ( '<STR_LIT>' , '<STR_LIT>' ) ] <EOL> _helper_canExtractX ( text , extract_fn , expected ) <EOL> def test_canExtractEntityGroups ( ) : <EOL> text = "<STR_LIT>" <EOL> extract_fn = Machine . _extract_entity_groups <EOL> expected = [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> _helper_canExtractX ( text , extract_fn , expected ) <EOL> def test_canExtractEntities ( ) : <EOL> text = "<STR_LIT>" <EOL> extract_fn = Machine . _extract_entities <EOL> expected = [ ( '<STR_LIT>' , '<STR_LIT>' ) , ( '<STR_LIT>' , '<STR_LIT>' ) ] <EOL> _helper_canExtractX ( text , extract_fn , expected ) <EOL> def test_canExtractIds ( ) : <EOL> text = "<STR_LIT>" <EOL> extract_fn = Machine . _extract_ids <EOL> expected = [ ( '<STR_LIT>' , '<STR_LIT>' ) , ( '<STR_LIT>' , '<STR_LIT>' ) ] <EOL> _helper_canExtractX ( text , extract_fn , expected ) <EOL> def test_canExtractUsernames ( ) : <EOL> text = "<STR_LIT>" <EOL> extract_fn = Machine . _extract_usernames <EOL> expected = [ ( '<STR_LIT>' , '<STR_LIT>' ) , ( <EOL> '<STR_LIT>' , '<STR_LIT>' ) , ( '<STR_LIT>' , '<STR_LIT>' ) ] <EOL> _helper_canExtractX ( text , extract_fn , expected ) <EOL> def test_canExtractEmails ( ) : <EOL> text = "<STR_LIT>" <EOL> extract_fn = Machine . _extract_emails <EOL> expected = [ ( '<STR_LIT>' , '<STR_LIT>' ) ] <EOL> _helper_canExtractX ( text , extract_fn , expected ) <EOL> def test_canExtractPhones ( ) : <EOL> text = "<STR_LIT>" <EOL> extract_fn = Machine . _extract_phones <EOL> expected = [ ( '<STR_LIT>' , '<STR_LIT>' ) ] <EOL> _helper_canExtractX ( text , extract_fn , expected ) <EOL> def _helper_canExtractX ( text = '<STR_LIT>' , extract_fn = None , expected = None ) : <EOL> actual = extract_fn ( text ) <EOL> assert ( set ( expected ) == set ( <EOL> actual ) ) , "<STR_LIT>" % ( set ( expected ) , set ( actual ) ) <EOL> assert ( len ( expected ) == len ( <EOL> actual ) ) , "<STR_LIT>" % ( len ( expected ) , len ( actual ) ) </s>
