<s> import os <EOL> import tempfile <EOL> import shutil <EOL> from unittest import TestCase <EOL> from email_parser import fs , clients , cmd <EOL> def read_fixture ( filename ) : <EOL> with open ( os . path . join ( '<STR_LIT>' , filename ) ) as fp : <EOL> return fp . read ( ) <EOL> class TestParser ( TestCase ) : <EOL> maxDiff = None <EOL> def setUp ( self ) : <EOL> self . dest = tempfile . mkdtemp ( ) <EOL> settings = cmd . default_settings ( ) . _asdict ( ) <EOL> settings [ '<STR_LIT>' ] = self . dest <EOL> settings [ '<STR_LIT:source>' ] = '<STR_LIT>' <EOL> settings [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> settings [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> settings [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> self . settings = cmd . Settings ( ** settings ) <EOL> self . client = clients . CustomerIoClient ( ) <EOL> def tearDown ( self ) : <EOL> shutil . rmtree ( self . dest ) <EOL> def _run_and_assert ( self , filename , fixture_filename ) : <EOL> self . client . parse ( '<STR_LIT:email>' , self . settings ) <EOL> expected = read_fixture ( fixture_filename ) . strip ( ) <EOL> actual = fs . read_file ( self . dest , filename ) . strip ( ) <EOL> self . assertEqual ( expected , actual ) <EOL> def test_subject ( self ) : <EOL> self . _run_and_assert ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> def test_text ( self ) : <EOL> self . _run_and_assert ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> def test_html ( self ) : <EOL> self . _run_and_assert ( '<STR_LIT>' , '<STR_LIT>' ) </s>
