<s> "<STR_LIT>" <EOL> __version__ = "<STR_LIT>" <EOL> import unittest <EOL> import os <EOL> import mplStyle . types . convert as cvt <EOL> class TesttoExactListOf ( unittest . TestCase ) : <EOL> """<STR_LIT>""" <EOL> def setUp ( self ) : <EOL> """<STR_LIT>""" <EOL> def tearDown ( self ) : <EOL> """<STR_LIT>""" <EOL> pass <EOL> def testToExactListOf ( self ) : <EOL> """<STR_LIT>""" <EOL> converter = cvt . toExactListOf <EOL> cvtList = [ cvt . Converter ( cvt . toType , float , allowNone = False ) ] <EOL> d1 = "<STR_LIT>" <EOL> right = [ <NUM_LIT:10> ] <EOL> result = converter ( [ d1 ] , cvtList ) <EOL> self . assertEqual ( right , result , <EOL> "<STR_LIT>" ) <EOL> self . assertRaises ( Exception , converter , d1 , cvtList , name = '<STR_LIT:value>' , <EOL> msg = "<STR_LIT>" ) <EOL> self . assertRaises ( Exception , converter , [ d1 , d1 ] , cvtList , <EOL> name = '<STR_LIT:value>' , <EOL> msg = "<STR_LIT>" ) <EOL> self . assertRaises ( Exception , converter , [ "<STR_LIT>" ] , cvtList , <EOL> name = '<STR_LIT:value>' , <EOL> msg = "<STR_LIT>" ) <EOL> self . assertRaises ( Exception , converter , None , cvtList , name = '<STR_LIT:value>' , <EOL> msg = "<STR_LIT>" ) <EOL> cvtList = [ cvt . Converter ( cvt . toType , float ) , <EOL> cvt . Converter ( cvt . toType , str ) ] <EOL> s1 = "<STR_LIT:test>" <EOL> f1 = "<STR_LIT>" <EOL> right = [ <NUM_LIT> , "<STR_LIT:test>" ] <EOL> result = converter ( [ f1 , s1 ] , cvtList ) <EOL> self . assertEqual ( right , result , <EOL> "<STR_LIT>" ) <EOL> result = converter ( ( f1 , s1 ) , cvtList ) <EOL> self . assertEqual ( right , result , "<STR_LIT>" ) <EOL> self . assertRaises ( Exception , converter , s1 , cvtList , <EOL> msg = "<STR_LIT>" ) <EOL> self . assertRaises ( Exception , converter , [ s1 ] , cvtList , <EOL> msg = "<STR_LIT>" ) <EOL> self . assertRaises ( Exception , converter , [ f1 , s1 ] , cvtList , <EOL> msg = "<STR_LIT>" ) <EOL> self . assertRaises ( Exception , converter , None , cvtList , <EOL> msg = "<STR_LIT>" ) <EOL> def testAllowNone ( self ) : <EOL> """<STR_LIT>""" <EOL> converter = cvt . toExactListOf <EOL> cvtList = [ cvt . Converter ( cvt . toType , float ) ] <EOL> result = converter ( None , cvtList , allowNone = True ) <EOL> self . assertEqual ( None , result , "<STR_LIT>" ) <EOL> s1 = "<STR_LIT>" <EOL> right = [ <NUM_LIT> ] <EOL> result = converter ( [ s1 ] , cvtList , allowNone = True ) <EOL> self . assertEqual ( right , result , "<STR_LIT>" ) </s>
