<s> import pickle <EOL> import unittest <EOL> import xml . dom <EOL> from xml . dom . minicompat import * <EOL> class EmptyNodeListTestCase ( unittest . TestCase ) : <EOL> """<STR_LIT>""" <EOL> def test_emptynodelist_item ( self ) : <EOL> node_list = EmptyNodeList ( ) <EOL> self . assertIsNone ( node_list . item ( <NUM_LIT:0> ) ) <EOL> self . assertIsNone ( node_list . item ( - <NUM_LIT:1> ) ) <EOL> with self . assertRaises ( IndexError ) : <EOL> node_list [ <NUM_LIT:0> ] <EOL> with self . assertRaises ( IndexError ) : <EOL> node_list [ - <NUM_LIT:1> ] <EOL> def test_emptynodelist_length ( self ) : <EOL> node_list = EmptyNodeList ( ) <EOL> self . assertEqual ( node_list . length , <NUM_LIT:0> ) <EOL> with self . assertRaises ( xml . dom . NoModificationAllowedErr ) : <EOL> node_list . length = <NUM_LIT> <EOL> def test_emptynodelist___add__ ( self ) : <EOL> node_list = EmptyNodeList ( ) + NodeList ( ) <EOL> self . assertEqual ( node_list , NodeList ( ) ) <EOL> def test_emptynodelist___radd__ ( self ) : <EOL> node_list = [ <NUM_LIT:1> , <NUM_LIT:2> ] + EmptyNodeList ( ) <EOL> self . assertEqual ( node_list , [ <NUM_LIT:1> , <NUM_LIT:2> ] ) <EOL> class NodeListTestCase ( unittest . TestCase ) : <EOL> """<STR_LIT>""" <EOL> def test_nodelist_item ( self ) : <EOL> node_list = NodeList ( ) <EOL> self . assertIsNone ( node_list . item ( <NUM_LIT:0> ) ) <EOL> self . assertIsNone ( node_list . item ( - <NUM_LIT:1> ) ) <EOL> with self . assertRaises ( IndexError ) : <EOL> node_list [ <NUM_LIT:0> ] <EOL> with self . assertRaises ( IndexError ) : <EOL> node_list [ - <NUM_LIT:1> ] <EOL> node_list . append ( <NUM_LIT> ) <EOL> node_list . append ( <NUM_LIT> ) <EOL> self . assertEqual ( node_list . item ( <NUM_LIT:0> ) , <NUM_LIT> ) <EOL> self . assertIsNone ( node_list . item ( - <NUM_LIT:1> ) ) <EOL> self . assertEqual ( node_list [ <NUM_LIT:0> ] , <NUM_LIT> ) <EOL> self . assertEqual ( node_list [ - <NUM_LIT:1> ] , <NUM_LIT> ) <EOL> def test_nodelist_length ( self ) : <EOL> node_list = NodeList ( [ <NUM_LIT:1> , <NUM_LIT:2> ] ) <EOL> self . assertEqual ( node_list . length , <NUM_LIT:2> ) <EOL> with self . assertRaises ( xml . dom . NoModificationAllowedErr ) : <EOL> node_list . length = <NUM_LIT> <EOL> def test_nodelist___add__ ( self ) : <EOL> node_list = NodeList ( [ <NUM_LIT:3> , <NUM_LIT:4> ] ) + [ <NUM_LIT:1> , <NUM_LIT:2> ] <EOL> self . assertEqual ( node_list , NodeList ( [ <NUM_LIT:3> , <NUM_LIT:4> , <NUM_LIT:1> , <NUM_LIT:2> ] ) ) <EOL> def test_nodelist___radd__ ( self ) : <EOL> node_list = [ <NUM_LIT:1> , <NUM_LIT:2> ] + NodeList ( [ <NUM_LIT:3> , <NUM_LIT:4> ] ) <EOL> self . assertEqual ( node_list , NodeList ( [ <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> , <NUM_LIT:4> ] ) ) <EOL> def test_nodelist_pickle_roundtrip ( self ) : <EOL> node_list = NodeList ( ) <EOL> pickled = pickle . dumps ( node_list ) <EOL> unpickled = pickle . loads ( pickled ) <EOL> self . assertEqual ( unpickled , node_list ) <EOL> node_list . append ( <NUM_LIT:1> ) <EOL> node_list . append ( <NUM_LIT:2> ) <EOL> pickled = pickle . dumps ( node_list ) <EOL> unpickled = pickle . loads ( pickled ) <EOL> self . assertEqual ( unpickled , node_list ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> unittest . main ( ) </s>
