<s> from pymysql . tests import base <EOL> import pymysql . cursors <EOL> import datetime <EOL> class TestDictCursor ( base . PyMySQLTestCase ) : <EOL> def test_DictCursor ( self ) : <EOL> conn = self . connections [ <NUM_LIT:0> ] <EOL> c = conn . cursor ( pymysql . cursors . DictCursor ) <EOL> c . execute ( """<STR_LIT>""" ) <EOL> data = ( ( "<STR_LIT>" , <NUM_LIT> , "<STR_LIT>" ) , <EOL> ( "<STR_LIT>" , <NUM_LIT> , "<STR_LIT>" ) , <EOL> ( "<STR_LIT>" , <NUM_LIT:100> , "<STR_LIT>" ) ) <EOL> bob = { '<STR_LIT:name>' : '<STR_LIT>' , '<STR_LIT>' : <NUM_LIT> , '<STR_LIT>' : datetime . datetime ( <NUM_LIT> , <NUM_LIT:0> <NUM_LIT:2> , <NUM_LIT:6> , <NUM_LIT> , <NUM_LIT:0> <NUM_LIT:4> , <NUM_LIT> ) } <EOL> jim = { '<STR_LIT:name>' : '<STR_LIT>' , '<STR_LIT>' : <NUM_LIT> , '<STR_LIT>' : datetime . datetime ( <NUM_LIT> , <NUM_LIT:0> <NUM_LIT:5> , <NUM_LIT:9> , <NUM_LIT> , <NUM_LIT:12> , <NUM_LIT> ) } <EOL> fred = { '<STR_LIT:name>' : '<STR_LIT>' , '<STR_LIT>' : <NUM_LIT:100> , '<STR_LIT>' : datetime . datetime ( <NUM_LIT> , <NUM_LIT:9> , <NUM_LIT:12> , <NUM_LIT:1> , <NUM_LIT:1> , <NUM_LIT:1> ) } <EOL> try : <EOL> c . executemany ( "<STR_LIT>" , data ) <EOL> c . execute ( "<STR_LIT>" ) <EOL> bob [ '<STR_LIT>' ] = <NUM_LIT:20> <EOL> c . execute ( "<STR_LIT>" ) <EOL> r = c . fetchone ( ) <EOL> self . assertEqual ( bob , r , "<STR_LIT>" ) <EOL> c . execute ( "<STR_LIT>" ) <EOL> r = c . fetchall ( ) <EOL> self . assertEqual ( ( bob , ) , r , "<STR_LIT>" ) <EOL> c . execute ( "<STR_LIT>" ) <EOL> for r in c : <EOL> self . assertEqual ( bob , r , "<STR_LIT>" ) <EOL> c . execute ( "<STR_LIT>" ) <EOL> r = c . fetchall ( ) <EOL> self . assertEqual ( ( bob , jim , fred ) , r , "<STR_LIT>" ) <EOL> c . execute ( "<STR_LIT>" ) <EOL> r = [ x for x in c ] <EOL> self . assertEqual ( [ bob , jim , fred ] , r , "<STR_LIT>" ) <EOL> c . execute ( "<STR_LIT>" ) <EOL> r = c . fetchmany ( <NUM_LIT:2> ) <EOL> self . assertEqual ( ( bob , jim ) , r , "<STR_LIT>" ) <EOL> finally : <EOL> c . execute ( "<STR_LIT>" ) <EOL> __all__ = [ "<STR_LIT>" ] <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> import unittest <EOL> unittest . main ( ) </s>
