<s> """<STR_LIT>""" <EOL> __author__ = '<STR_LIT>' <EOL> import unittest <EOL> import geocell <EOL> import geotypes <EOL> class GeocellTests ( unittest . TestCase ) : <EOL> def test_compute ( self ) : <EOL> cell = geocell . compute ( geotypes . Point ( <NUM_LIT> , - <NUM_LIT> ) , <NUM_LIT> ) <EOL> self . assertEqual ( <NUM_LIT> , len ( cell ) ) <EOL> self . assertTrue ( geocell . is_valid ( cell ) ) <EOL> self . assertTrue ( geocell . contains_point ( cell , geotypes . Point ( <NUM_LIT> , - <NUM_LIT> ) ) ) <EOL> lowres_cell = geocell . compute ( geotypes . Point ( <NUM_LIT> , - <NUM_LIT> ) , <NUM_LIT:8> ) <EOL> self . assertTrue ( cell . startswith ( lowres_cell ) ) <EOL> self . assertTrue ( geocell . contains_point ( lowres_cell , <EOL> geotypes . Point ( <NUM_LIT> , - <NUM_LIT> ) ) ) <EOL> cell = geocell . compute ( geotypes . Point ( <NUM_LIT:0> , <NUM_LIT:0> ) , <NUM_LIT:0> ) <EOL> self . assertEqual ( <NUM_LIT:0> , len ( cell ) ) <EOL> self . assertFalse ( geocell . is_valid ( cell ) ) <EOL> def test_compute_box ( self ) : <EOL> cell = geocell . compute ( geotypes . Point ( <NUM_LIT> , - <NUM_LIT> ) , <NUM_LIT> ) <EOL> box = geocell . compute_box ( cell ) <EOL> self . assertTrue ( box . south <= <NUM_LIT> and <NUM_LIT> <= box . north and <EOL> box . west <= - <NUM_LIT> and - <NUM_LIT> <= box . east ) <EOL> def test_adjacent ( self ) : <EOL> cell = geocell . compute ( geotypes . Point ( <NUM_LIT> , - <NUM_LIT> ) , <NUM_LIT> ) <EOL> box = geocell . compute_box ( cell ) <EOL> self . assertEquals ( box . north , <EOL> geocell . compute_box ( geocell . adjacent ( cell , ( <NUM_LIT:0> , <NUM_LIT:1> ) ) ) . south ) <EOL> self . assertEquals ( box . south , <EOL> geocell . compute_box ( geocell . adjacent ( cell , ( <NUM_LIT:0> , - <NUM_LIT:1> ) ) ) . north ) <EOL> self . assertEquals ( box . east , <EOL> geocell . compute_box ( geocell . adjacent ( cell , ( <NUM_LIT:1> , <NUM_LIT:0> ) ) ) . west ) <EOL> self . assertEquals ( box . west , <EOL> geocell . compute_box ( geocell . adjacent ( cell , ( - <NUM_LIT:1> , <NUM_LIT:0> ) ) ) . east ) <EOL> self . assertEquals ( <NUM_LIT:8> , len ( geocell . all_adjacents ( cell ) ) ) <EOL> self . assertTrue ( <EOL> geocell . collinear ( cell , geocell . adjacent ( cell , ( <NUM_LIT:0> , <NUM_LIT:1> ) ) , True ) ) <EOL> self . assertFalse ( <EOL> geocell . collinear ( cell , geocell . adjacent ( cell , ( <NUM_LIT:0> , <NUM_LIT:1> ) ) , False ) ) <EOL> self . assertTrue ( <EOL> geocell . collinear ( cell , geocell . adjacent ( cell , ( <NUM_LIT:1> , <NUM_LIT:0> ) ) , False ) ) <EOL> self . assertFalse ( <EOL> geocell . collinear ( cell , geocell . adjacent ( cell , ( <NUM_LIT:1> , <NUM_LIT:0> ) ) , True ) ) <EOL> def test_interpolation ( self ) : <EOL> cell = geocell . compute ( geotypes . Point ( <NUM_LIT> , - <NUM_LIT> ) , <NUM_LIT> ) <EOL> sw_adjacent = geocell . adjacent ( cell , ( - <NUM_LIT:1> , - <NUM_LIT:1> ) ) <EOL> sw_adjacent2 = geocell . adjacent ( sw_adjacent , ( - <NUM_LIT:1> , - <NUM_LIT:1> ) ) <EOL> self . assertEquals ( <NUM_LIT:4> , len ( geocell . interpolate ( cell , sw_adjacent ) ) ) <EOL> self . assertEquals ( <NUM_LIT:4> , geocell . interpolation_count ( cell , sw_adjacent ) ) <EOL> self . assertEquals ( <NUM_LIT:9> , len ( geocell . interpolate ( cell , sw_adjacent2 ) ) ) <EOL> self . assertEquals ( <NUM_LIT:9> , geocell . interpolation_count ( cell , sw_adjacent2 ) ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> unittest . main ( ) </s>
