<s> import unittest <EOL> import aepack <EOL> import aetypes <EOL> import os <EOL> from test import test_support <EOL> class TestAepack ( unittest . TestCase ) : <EOL> OBJECTS = [ <EOL> aetypes . Enum ( '<STR_LIT>' ) , <EOL> aetypes . Type ( '<STR_LIT:type>' ) , <EOL> aetypes . Keyword ( '<STR_LIT>' ) , <EOL> aetypes . Range ( <NUM_LIT:1> , <NUM_LIT:10> ) , <EOL> aetypes . Comparison ( <NUM_LIT:1> , '<STR_LIT>' , <NUM_LIT:10> ) , <EOL> aetypes . Logical ( '<STR_LIT>' , <NUM_LIT:1> ) , <EOL> aetypes . IntlText ( <NUM_LIT:0> , <NUM_LIT:0> , '<STR_LIT>' ) , <EOL> aetypes . IntlWritingCode ( <NUM_LIT:0> , <NUM_LIT:0> ) , <EOL> aetypes . QDPoint ( <NUM_LIT:50> , <NUM_LIT:100> ) , <EOL> aetypes . QDRectangle ( <NUM_LIT:50> , <NUM_LIT:100> , <NUM_LIT> , <NUM_LIT:200> ) , <EOL> aetypes . RGBColor ( <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ) , <EOL> aetypes . Unknown ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> aetypes . Character ( <NUM_LIT:1> ) , <EOL> aetypes . Character ( <NUM_LIT:2> , aetypes . Line ( <NUM_LIT:2> ) ) , <EOL> ] <EOL> def test_roundtrip_string ( self ) : <EOL> o = '<STR_LIT>' <EOL> packed = aepack . pack ( o ) <EOL> unpacked = aepack . unpack ( packed ) <EOL> self . assertEqual ( o , unpacked ) <EOL> def test_roundtrip_int ( self ) : <EOL> o = <NUM_LIT:12> <EOL> packed = aepack . pack ( o ) <EOL> unpacked = aepack . unpack ( packed ) <EOL> self . assertEqual ( o , unpacked ) <EOL> def test_roundtrip_float ( self ) : <EOL> o = <NUM_LIT> <EOL> packed = aepack . pack ( o ) <EOL> unpacked = aepack . unpack ( packed ) <EOL> self . assertEqual ( o , unpacked ) <EOL> def test_roundtrip_None ( self ) : <EOL> o = None <EOL> packed = aepack . pack ( o ) <EOL> unpacked = aepack . unpack ( packed ) <EOL> self . assertEqual ( o , unpacked ) <EOL> def test_roundtrip_aeobjects ( self ) : <EOL> for o in self . OBJECTS : <EOL> packed = aepack . pack ( o ) <EOL> unpacked = aepack . unpack ( packed ) <EOL> self . assertEqual ( repr ( o ) , repr ( unpacked ) ) <EOL> def test_roundtrip_FSSpec ( self ) : <EOL> try : <EOL> import Carbon . File <EOL> except : <EOL> return <EOL> o = Carbon . File . FSSpec ( os . curdir ) <EOL> packed = aepack . pack ( o ) <EOL> unpacked = aepack . unpack ( packed ) <EOL> self . assertEqual ( o . as_pathname ( ) , unpacked . as_pathname ( ) ) <EOL> def test_roundtrip_Alias ( self ) : <EOL> try : <EOL> import Carbon . File <EOL> except : <EOL> return <EOL> o = Carbon . File . FSSpec ( os . curdir ) . NewAliasMinimal ( ) <EOL> packed = aepack . pack ( o ) <EOL> unpacked = aepack . unpack ( packed ) <EOL> self . assertEqual ( o . FSResolveAlias ( None ) [ <NUM_LIT:0> ] . as_pathname ( ) , <EOL> unpacked . FSResolveAlias ( None ) [ <NUM_LIT:0> ] . as_pathname ( ) ) <EOL> def test_main ( ) : <EOL> test_support . run_unittest ( TestAepack ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> test_main ( ) </s>
