<s> """<STR_LIT>""" <EOL> import unittest <EOL> from pywps . inout . literaltypes import * <EOL> class ConvertorTest ( unittest . TestCase ) : <EOL> """<STR_LIT>""" <EOL> def test_integer ( self ) : <EOL> """<STR_LIT>""" <EOL> self . assertEqual ( convert_integer ( '<STR_LIT:1.0>' ) , <NUM_LIT:1> ) <EOL> self . assertEqual ( convert_integer ( <NUM_LIT:1> ) , <NUM_LIT:1> ) <EOL> with self . assertRaises ( ValueError ) : <EOL> convert_integer ( '<STR_LIT:a>' ) <EOL> def test_float ( self ) : <EOL> """<STR_LIT>""" <EOL> self . assertEqual ( convert_float ( '<STR_LIT:1.0>' ) , <NUM_LIT:1.0> ) <EOL> self . assertEqual ( convert_float ( <NUM_LIT:1> ) , <NUM_LIT:1.0> ) <EOL> with self . assertRaises ( ValueError ) : <EOL> convert_float ( '<STR_LIT:a>' ) <EOL> def test_string ( self ) : <EOL> """<STR_LIT>""" <EOL> self . assertEqual ( convert_string ( '<STR_LIT:1.0>' ) , '<STR_LIT:1.0>' ) <EOL> self . assertEqual ( convert_string ( <NUM_LIT:1> ) , '<STR_LIT:1>' ) <EOL> self . assertEqual ( convert_string ( '<STR_LIT:a>' ) , '<STR_LIT:a>' ) <EOL> def test_boolean ( self ) : <EOL> """<STR_LIT>""" <EOL> self . assertTrue ( convert_boolean ( '<STR_LIT:1.0>' ) ) <EOL> self . assertTrue ( convert_boolean ( <NUM_LIT:1> ) ) <EOL> self . assertTrue ( convert_boolean ( '<STR_LIT:a>' ) ) <EOL> self . assertFalse ( convert_boolean ( '<STR_LIT:f>' ) ) <EOL> self . assertFalse ( convert_boolean ( '<STR_LIT>' ) ) <EOL> self . assertFalse ( convert_boolean ( False ) ) <EOL> self . assertFalse ( convert_boolean ( <NUM_LIT:0> ) ) <EOL> self . assertTrue ( convert_boolean ( - <NUM_LIT:1> ) ) <EOL> def load_tests ( loader = None , tests = None , pattern = None ) : <EOL> if not loader : <EOL> loader = unittest . TestLoader ( ) <EOL> suite_list = [ <EOL> loader . loadTestsFromTestCase ( ConvertorTest ) <EOL> ] <EOL> return unittest . TestSuite ( suite_list ) </s>
