<s> from __future__ import print_function <EOL> from __future__ import absolute_import <EOL> from tables . tests import common <EOL> from tables . tests . common import verbose <EOL> from tables . tests . common import unittest , test_filename <EOL> from tables . tests . common import PyTablesTestCase as TestCase <EOL> from six . moves import range <EOL> class IndexesTestCase ( common . TestFileMixin , TestCase ) : <EOL> def setUp ( self ) : <EOL> super ( IndexesTestCase , self ) . setUp ( ) <EOL> self . table1 = self . h5file . root . table1 <EOL> self . table2 = self . h5file . root . table2 <EOL> self . il = <NUM_LIT:0> <EOL> self . sl = self . table1 . cols . var1 . index . slicesize <EOL> def test00_version ( self ) : <EOL> """<STR_LIT>""" <EOL> t1var1 = self . table1 . cols . var1 <EOL> if "<STR_LIT>" in self . h5fname : <EOL> self . assertEqual ( t1var1 . index . _v_version , "<STR_LIT>" ) <EOL> elif "<STR_LIT>" in self . h5fname : <EOL> self . assertEqual ( t1var1 . index . _v_version , "<STR_LIT>" ) <EOL> def test01_string ( self ) : <EOL> """<STR_LIT>""" <EOL> if common . verbose : <EOL> print ( '<STR_LIT:\n>' , '<STR_LIT>' * <NUM_LIT:30> ) <EOL> print ( "<STR_LIT>" % self . __class__ . __name__ ) <EOL> table1 = self . table1 <EOL> table2 = self . table2 <EOL> il = str ( self . il ) . encode ( '<STR_LIT:ascii>' ) <EOL> sl = str ( self . sl ) . encode ( '<STR_LIT:ascii>' ) <EOL> t1var1 = table1 . cols . var1 <EOL> self . assertTrue ( t1var1 is not None ) <EOL> results1 = [ p [ "<STR_LIT>" ] for p in <EOL> table1 . where ( '<STR_LIT>' ) ] <EOL> results2 = [ p [ "<STR_LIT>" ] for p in table2 if il <= p [ "<STR_LIT>" ] <= sl ] <EOL> results1 . sort ( ) <EOL> results2 . sort ( ) <EOL> if verbose : <EOL> print ( "<STR_LIT>" , results2 ) <EOL> print ( "<STR_LIT>" , len ( results1 ) ) <EOL> print ( "<STR_LIT>" , len ( results2 ) ) <EOL> self . assertEqual ( len ( results1 ) , len ( results2 ) ) <EOL> self . assertEqual ( results1 , results2 ) <EOL> def test02_bool ( self ) : <EOL> """<STR_LIT>""" <EOL> if common . verbose : <EOL> print ( '<STR_LIT:\n>' , '<STR_LIT>' * <NUM_LIT:30> ) <EOL> print ( "<STR_LIT>" % self . __class__ . __name__ ) <EOL> table1 = self . table1 <EOL> table2 = self . table2 <EOL> t1var2 = table1 . cols . var2 <EOL> self . assertTrue ( t1var2 is not None ) <EOL> results1 = [ p [ "<STR_LIT>" ] for p in table1 . where ( '<STR_LIT>' ) ] <EOL> results2 = [ p [ "<STR_LIT>" ] for p in table2 if p [ "<STR_LIT>" ] is True ] <EOL> if verbose : <EOL> print ( "<STR_LIT>" , results1 ) <EOL> print ( "<STR_LIT>" , results2 ) <EOL> print ( "<STR_LIT>" , len ( results1 ) ) <EOL> print ( "<STR_LIT>" , len ( results2 ) ) <EOL> self . assertEqual ( len ( results1 ) , len ( results2 ) ) <EOL> self . assertEqual ( results1 , results2 ) <EOL> def test03_int ( self ) : <EOL> """<STR_LIT>""" <EOL> if common . verbose : <EOL> print ( '<STR_LIT:\n>' , '<STR_LIT>' * <NUM_LIT:30> ) <EOL> print ( "<STR_LIT>" % self . __class__ . __name__ ) <EOL> table1 = self . table1 <EOL> table2 = self . table2 <EOL> il = int ( self . il ) <EOL> sl = int ( self . sl ) <EOL> t1col = table1 . cols . var3 <EOL> self . assertTrue ( t1col is not None ) <EOL> results1 = [ p [ "<STR_LIT>" ] for p in table1 . where ( '<STR_LIT>' ) ] <EOL> results2 = [ p [ "<STR_LIT>" ] for p in table2 <EOL> if il <= p [ "<STR_LIT>" ] <= sl ] <EOL> results1 . sort ( ) <EOL> results2 . sort ( ) <EOL> if verbose : <EOL> print ( "<STR_LIT>" , len ( results1 ) ) <EOL> print ( "<STR_LIT>" , len ( results2 ) ) <EOL> self . assertEqual ( len ( results1 ) , len ( results2 ) ) <EOL> self . assertEqual ( results1 , results2 ) <EOL> def test04_float ( self ) : <EOL> """<STR_LIT>""" <EOL> if common . verbose : <EOL> print ( '<STR_LIT:\n>' , '<STR_LIT>' * <NUM_LIT:30> ) <EOL> print ( "<STR_LIT>" % self . __class__ . __name__ ) <EOL> table1 = self . table1 <EOL> table2 = self . table2 <EOL> il = float ( self . il ) <EOL> sl = float ( self . sl ) <EOL> t1col = table1 . cols . var4 <EOL> self . assertTrue ( t1col is not None ) <EOL> results1 = [ p [ "<STR_LIT>" ] for p in table1 . where ( '<STR_LIT>' ) ] <EOL> results2 = [ p [ "<STR_LIT>" ] for p in table2 <EOL> if il <= p [ "<STR_LIT>" ] <= sl ] <EOL> results1 . sort ( ) <EOL> results2 . sort ( ) <EOL> if verbose : <EOL> print ( "<STR_LIT>" , len ( results1 ) ) <EOL> print ( "<STR_LIT>" , len ( results2 ) ) <EOL> self . assertEqual ( len ( results1 ) , len ( results2 ) ) <EOL> self . assertEqual ( results1 . sort ( ) , results2 . sort ( ) ) <EOL> class Indexes2_0TestCase ( IndexesTestCase ) : <EOL> h5fname = test_filename ( "<STR_LIT>" ) <EOL> class Indexes2_1TestCase ( IndexesTestCase ) : <EOL> h5fname = test_filename ( "<STR_LIT>" ) <EOL> def suite ( ) : <EOL> theSuite = unittest . TestSuite ( ) <EOL> niter = <NUM_LIT:1> <EOL> for n in range ( niter ) : <EOL> theSuite . addTest ( unittest . makeSuite ( Indexes2_0TestCase ) ) <EOL> theSuite . addTest ( unittest . makeSuite ( Indexes2_1TestCase ) ) <EOL> return theSuite <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> import sys <EOL> common . parse_argv ( sys . argv ) <EOL> common . print_versions ( ) <EOL> unittest . main ( defaultTest = '<STR_LIT>' ) </s>
