<s> import pyexcel as pe <EOL> import datetime <EOL> from textwrap import dedent <EOL> from db import Session , Base , Pyexcel , engine <EOL> class TestSQL : <EOL> def setUp ( self ) : <EOL> Base . metadata . drop_all ( engine ) <EOL> Base . metadata . create_all ( engine ) <EOL> p1 = Pyexcel ( id = <NUM_LIT:0> , <EOL> name = "<STR_LIT>" , <EOL> weight = <NUM_LIT> , <EOL> birth = datetime . date ( <NUM_LIT> , <NUM_LIT:11> , <NUM_LIT:11> ) ) <EOL> session = Session ( ) <EOL> session . add ( p1 ) <EOL> p1 = Pyexcel ( id = <NUM_LIT:1> , <EOL> name = "<STR_LIT>" , <EOL> weight = <NUM_LIT> , <EOL> birth = datetime . date ( <NUM_LIT> , <NUM_LIT:11> , <NUM_LIT:12> ) ) <EOL> session . add ( p1 ) <EOL> session . commit ( ) <EOL> def test_sql ( self ) : <EOL> sheet = pe . load_from_sql ( Session ( ) , Pyexcel ) <EOL> content = dedent ( """<STR_LIT>""" ) . strip ( '<STR_LIT:\n>' ) <EOL> assert str ( sheet ) == content <EOL> class TestEmptyTable : <EOL> def setUp ( self ) : <EOL> Base . metadata . drop_all ( engine ) <EOL> Base . metadata . create_all ( engine ) <EOL> def test_empty_table ( self ) : <EOL> sheet = pe . load_from_sql ( Session ( ) , Pyexcel ) <EOL> assert sheet is not None </s>
