<s> from graphserver . core import * <EOL> import unittest <EOL> class TestEgress ( unittest . TestCase ) : <EOL> def test_street ( self ) : <EOL> s = Egress ( "<STR_LIT>" , <NUM_LIT> ) <EOL> assert s . name == "<STR_LIT>" <EOL> assert s . length == <NUM_LIT> <EOL> assert s . to_xml ( ) == "<STR_LIT>" <EOL> def test_destroy ( self ) : <EOL> s = Egress ( "<STR_LIT>" , <NUM_LIT> ) <EOL> s . destroy ( ) <EOL> assert s . soul == None <EOL> def test_street_big_length ( self ) : <EOL> s = Egress ( "<STR_LIT>" , <NUM_LIT> ) <EOL> assert s . name == "<STR_LIT>" <EOL> assert s . length == <NUM_LIT> <EOL> assert s . to_xml ( ) == "<STR_LIT>" <EOL> def test_walk ( self ) : <EOL> s = Egress ( "<STR_LIT>" , <NUM_LIT:10> ) <EOL> wo = WalkOptions ( ) <EOL> wo . walking_reluctance = <NUM_LIT:1> <EOL> after = s . walk ( State ( <NUM_LIT:0> , <NUM_LIT:0> ) , wo ) <EOL> wo . destroy ( ) <EOL> self . assertEqual ( after . time , <NUM_LIT:9> ) <EOL> self . assertEqual ( after . weight , <NUM_LIT:9> ) <EOL> self . assertEqual ( after . dist_walked , <NUM_LIT:10> ) <EOL> self . assertEqual ( after . prev_edge . __class__ , Egress ) <EOL> self . assertEqual ( after . prev_edge . name , "<STR_LIT>" ) <EOL> self . assertEqual ( after . num_agencies , <NUM_LIT:0> ) <EOL> def test_walk_back ( self ) : <EOL> s = Egress ( "<STR_LIT>" , <NUM_LIT:10> ) <EOL> before = s . walk_back ( State ( <NUM_LIT:0> , <NUM_LIT:100> ) , WalkOptions ( ) ) <EOL> self . assertEqual ( before . time , <NUM_LIT:100> - ( <NUM_LIT:9> ) ) <EOL> self . assertEqual ( before . weight , <NUM_LIT:9> ) <EOL> self . assertEqual ( before . dist_walked , <NUM_LIT> ) <EOL> self . assertEqual ( before . prev_edge . type , <NUM_LIT:12> ) <EOL> self . assertEqual ( before . prev_edge . name , "<STR_LIT>" ) <EOL> self . assertEqual ( before . num_agencies , <NUM_LIT:0> ) <EOL> def test_getstate ( self ) : <EOL> s = Egress ( "<STR_LIT>" , <NUM_LIT:2> ) <EOL> assert s . __getstate__ ( ) == ( '<STR_LIT>' , <NUM_LIT:2> ) <EOL> def test_graph ( self ) : <EOL> g = Graph ( ) <EOL> g . add_vertex ( "<STR_LIT:E>" ) <EOL> g . add_vertex ( "<STR_LIT:S>" ) <EOL> g . add_edge ( "<STR_LIT:E>" , "<STR_LIT:S>" , Egress ( "<STR_LIT>" , <NUM_LIT:10> ) ) <EOL> spt = g . shortest_path_tree ( "<STR_LIT:E>" , "<STR_LIT:S>" , State ( <NUM_LIT:0> , <NUM_LIT:0> ) , WalkOptions ( ) ) <EOL> assert spt <EOL> assert spt . __class__ == ShortestPathTree <EOL> assert spt . get_vertex ( "<STR_LIT:S>" ) . state . dist_walked == <NUM_LIT:10> <EOL> spt . destroy ( ) <EOL> g . destroy ( ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> tl = unittest . TestLoader ( ) <EOL> suite = tl . loadTestsFromTestCase ( TestEgress ) <EOL> unittest . TextTestRunner ( verbosity = <NUM_LIT:2> ) . run ( suite ) </s>
