<s> from pymysql import OperationalError , Warning <EOL> from pymysql . tests import base <EOL> import os <EOL> import warnings <EOL> __all__ = [ "<STR_LIT>" ] <EOL> class TestLoadLocal ( base . PyMySQLTestCase ) : <EOL> def test_no_file ( self ) : <EOL> """<STR_LIT>""" <EOL> conn = self . connections [ <NUM_LIT:0> ] <EOL> c = conn . cursor ( ) <EOL> c . execute ( "<STR_LIT>" ) <EOL> try : <EOL> self . assertRaises ( <EOL> OperationalError , <EOL> c . execute , <EOL> ( "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> ) <EOL> finally : <EOL> c . execute ( "<STR_LIT>" ) <EOL> c . close ( ) <EOL> def test_load_file ( self ) : <EOL> """<STR_LIT>""" <EOL> conn = self . connections [ <NUM_LIT:0> ] <EOL> c = conn . cursor ( ) <EOL> c . execute ( "<STR_LIT>" ) <EOL> filename = os . path . join ( os . path . dirname ( os . path . realpath ( __file__ ) ) , <EOL> '<STR_LIT:data>' , <EOL> '<STR_LIT>' ) <EOL> try : <EOL> c . execute ( <EOL> ( "<STR_LIT>" + <EOL> "<STR_LIT>" ) . format ( filename ) <EOL> ) <EOL> c . execute ( "<STR_LIT>" ) <EOL> self . assertEqual ( <NUM_LIT> , c . fetchone ( ) [ <NUM_LIT:0> ] ) <EOL> finally : <EOL> c . execute ( "<STR_LIT>" ) <EOL> def test_load_warnings ( self ) : <EOL> """<STR_LIT>""" <EOL> conn = self . connections [ <NUM_LIT:0> ] <EOL> c = conn . cursor ( ) <EOL> c . execute ( "<STR_LIT>" ) <EOL> filename = os . path . join ( os . path . dirname ( os . path . realpath ( __file__ ) ) , <EOL> '<STR_LIT:data>' , <EOL> '<STR_LIT>' ) <EOL> try : <EOL> with warnings . catch_warnings ( record = True ) as w : <EOL> warnings . simplefilter ( '<STR_LIT>' ) <EOL> c . execute ( <EOL> ( "<STR_LIT>" + <EOL> "<STR_LIT>" ) . format ( filename ) <EOL> ) <EOL> self . assertEqual ( w [ <NUM_LIT:0> ] . category , Warning ) <EOL> self . assertTrue ( "<STR_LIT>" in str ( w [ - <NUM_LIT:1> ] . message ) ) <EOL> finally : <EOL> c . execute ( "<STR_LIT>" ) <EOL> c . close ( ) <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> import unittest <EOL> unittest . main ( ) </s>
