def check_segments(coll, positions, linelength, lineoffset, orientation):
 segments = coll.get_segments()
 if ((orientation.lower() == u'horizontal') or (orientation.lower() == u'none') or (orientation is None)):
  pos1 = 1
  pos2 = 0
 elif (orientation.lower() == u'vertical'):
  pos1 = 0
  pos2 = 1
 else:
  raise ValueError(u"orientation must be 'horizontal' or 'vertical'")
 for (i, segment) in enumerate(segments):
  assert_equal(segment[(0, pos1)], (lineoffset + (linelength / 2.0)))
  assert_equal(segment[(1, pos1)], (lineoffset - (linelength / 2.0)))
  assert_equal(segment[(0, pos2)], positions[i])
  assert_equal(segment[(1, pos2)], positions[i])

def check_segments ( coll , positions , linelength , lineoffset , orientation ) : segments = coll . get_segments ( ) if ( ( orientation . lower ( ) == u'horizontal' ) or ( orientation . lower ( ) == u'none' ) or ( orientation is None ) ) : pos1 = 1 pos2 = 0 elif ( orientation . lower ( ) == u'vertical' ) : pos1 = 0 pos2 = 1 else : raise ValueError ( u"orientation must be 'horizontal' or 'vertical'" ) for ( i , segment ) in enumerate ( segments ) : assert_equal ( segment [ ( 0 , pos1 ) ] , ( lineoffset + ( linelength / 2.0 ) ) ) assert_equal ( segment [ ( 1 , pos1 ) ] , ( lineoffset - ( linelength / 2.0 ) ) ) assert_equal ( segment [ ( 0 , pos2 ) ] , positions [ i ] ) assert_equal ( segment [ ( 1 , pos2 ) ] , positions [ i ] )
check to make sure all values in the segment are correct .