<s> import unittest <EOL> import sys <EOL> from nipap . backend import Nipap , NipapDuplicateError , NipapValueError <EOL> class NipapSql ( unittest . TestCase ) : <EOL> nipap = Nipap ( ) <EOL> def clean_up ( self ) : <EOL> self . nipap . _execute ( "<STR_LIT>" ) <EOL> self . nipap . _execute ( "<STR_LIT>" ) <EOL> self . nipap . _execute ( "<STR_LIT>" ) <EOL> def setUp ( self ) : <EOL> self . clean_up ( ) <EOL> self . schema_id = self . nipap . add_schema ( { '<STR_LIT:name>' : '<STR_LIT>' , '<STR_LIT:description>' : '<STR_LIT>' } ) <EOL> def test_calc_indent ( self ) : <EOL> """<STR_LIT>""" <EOL> def test_db_constraints ( self ) : <EOL> """<STR_LIT>""" <EOL> self . assertEqual ( self . _inspre ( '<STR_LIT>' , '<STR_LIT>' ) , True , '<STR_LIT>' ) <EOL> self . assertRaises ( NipapDuplicateError , self . _inspre , '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . assertEqual ( self . _inspre ( '<STR_LIT>' , '<STR_LIT>' ) , True ) <EOL> self . assertEqual ( self . _inspre ( '<STR_LIT>' , '<STR_LIT>' ) , True ) <EOL> self . assertEqual ( self . _inspre ( '<STR_LIT>' , '<STR_LIT:host>' ) , True ) <EOL> self . assertEqual ( self . _inspre ( '<STR_LIT>' , '<STR_LIT:host>' ) , True ) <EOL> self . assertRaises ( NipapValueError , self . _inspre , '<STR_LIT>' , '<STR_LIT:host>' ) <EOL> self . assertRaises ( NipapValueError , self . _inspre , '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . assertRaises ( NipapValueError , self . _delpre , '<STR_LIT>' ) <EOL> self . assertRaises ( NipapValueError , self . _updpre , '<STR_LIT>' , '<STR_LIT>' ) <EOL> def _inspre ( self , prefix , prefix_type ) : <EOL> """<STR_LIT>""" <EOL> self . nipap . _execute ( "<STR_LIT>" , { '<STR_LIT>' : self . schema_id , '<STR_LIT>' : prefix , '<STR_LIT>' : prefix_type } ) <EOL> return True <EOL> def _updpre ( self , prefix , prefix_type ) : <EOL> """<STR_LIT>""" <EOL> self . nipap . _execute ( "<STR_LIT>" , { '<STR_LIT>' : self . schema_id , '<STR_LIT>' : prefix , '<STR_LIT>' : prefix_type } ) <EOL> return True <EOL> def _delpre ( self , prefix ) : <EOL> """<STR_LIT>""" <EOL> self . nipap . _execute ( "<STR_LIT>" , { '<STR_LIT>' : self . schema_id , '<STR_LIT>' : prefix } ) <EOL> return True <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> unittest . main ( ) <EOL> NipapSql . clean_up ( ) </s>
