<s> """<STR_LIT>""" <EOL> import sanpera . geometry as geom <EOL> import math <EOL> def test_vector_origin ( ) : <EOL> vec = geom . Vector ( <NUM_LIT:0> , <NUM_LIT:0> ) <EOL> assert vec == geom . origin <EOL> assert not vec <EOL> assert vec . x == <NUM_LIT:0> <EOL> assert vec . y == <NUM_LIT:0> <EOL> assert tuple ( vec ) == ( <NUM_LIT:0> , <NUM_LIT:0> ) <EOL> def test_vector_simple ( ) : <EOL> vec = geom . Vector ( <NUM_LIT:3> , <NUM_LIT:4> ) <EOL> assert vec <EOL> assert vec . x == <NUM_LIT:3> <EOL> assert vec . y == <NUM_LIT:4> <EOL> assert vec . magnitude == <NUM_LIT> <EOL> assert vec . direction == math . atan2 ( - <NUM_LIT:4> , <NUM_LIT:3> ) <EOL> assert vec == geom . Vector ( <NUM_LIT:3> , <NUM_LIT:4> ) <EOL> assert vec + <NUM_LIT:2> == geom . Vector ( <NUM_LIT:5> , <NUM_LIT:6> ) <EOL> assert vec - <NUM_LIT:2> == geom . Vector ( <NUM_LIT:1> , <NUM_LIT:2> ) <EOL> assert vec * <NUM_LIT:2> == geom . Vector ( <NUM_LIT:6> , <NUM_LIT:8> ) <EOL> def test_size_zero ( ) : <EOL> size = geom . Size ( <NUM_LIT:0> , <NUM_LIT:0> ) <EOL> assert size == geom . empty <EOL> assert not size <EOL> assert size . width == <NUM_LIT:0> <EOL> assert size . height == <NUM_LIT:0> <EOL> assert size . x == <NUM_LIT:0> <EOL> assert size . y == <NUM_LIT:0> <EOL> assert tuple ( size ) == ( <NUM_LIT:0> , <NUM_LIT:0> ) <EOL> def test_size_fit_area ( ) : <EOL> size = geom . Size ( <NUM_LIT:100> , <NUM_LIT:100> ) <EOL> assert size . fit_area ( <NUM_LIT:64> ) == geom . Size ( <NUM_LIT:8> , <NUM_LIT:8> ) <EOL> assert size . fit_area ( <NUM_LIT:64> , downscale = False ) == size <EOL> assert size . fit_area ( <NUM_LIT> ) == geom . Size ( <NUM_LIT> , <NUM_LIT> ) <EOL> assert size . fit_area ( <NUM_LIT> , upscale = False ) == size <EOL> size = geom . Size ( <NUM_LIT:200> , <NUM_LIT> ) <EOL> assert size . fit_area ( <NUM_LIT:100> ) == geom . Size ( <NUM_LIT:8> , <NUM_LIT:12> ) <EOL> assert size . fit_area ( <NUM_LIT:7> ) == geom . Size ( <NUM_LIT:2> , <NUM_LIT:3> ) <EOL> assert size . fit_area ( <NUM_LIT:8> ) == geom . Size ( <NUM_LIT:2> , <NUM_LIT:4> ) <EOL> assert size . fit_area ( <NUM_LIT:9> ) == geom . Size ( <NUM_LIT:3> , <NUM_LIT:3> ) <EOL> assert size . fit_area ( <NUM_LIT:10> ) == geom . Size ( <NUM_LIT:3> , <NUM_LIT:3> ) <EOL> assert size . fit_area ( <NUM_LIT:11> ) == geom . Size ( <NUM_LIT:2> , <NUM_LIT:5> ) <EOL> def test_size_fit_inside ( ) : <EOL> assert geom . Size ( <NUM_LIT:50> , <NUM_LIT:50> ) . fit_inside ( ( <NUM_LIT:10> , <NUM_LIT:10> ) ) == geom . Size ( <NUM_LIT:10> , <NUM_LIT:10> ) <EOL> assert geom . Size ( <NUM_LIT:50> , <NUM_LIT:50> ) . fit_inside ( ( <NUM_LIT:20> , <NUM_LIT:10> ) ) == geom . Size ( <NUM_LIT:10> , <NUM_LIT:10> ) <EOL> assert geom . Size ( <NUM_LIT:50> , <NUM_LIT:50> ) . fit_inside ( ( <NUM_LIT:10> , <NUM_LIT:20> ) ) == geom . Size ( <NUM_LIT:10> , <NUM_LIT:10> ) <EOL> assert geom . Size ( <NUM_LIT:50> , <NUM_LIT:50> ) . fit_inside ( ( <NUM_LIT:10> , <NUM_LIT:10> ) , upscale = False ) == geom . Size ( <NUM_LIT:10> , <NUM_LIT:10> ) <EOL> assert geom . Size ( <NUM_LIT:50> , <NUM_LIT:50> ) . fit_inside ( ( <NUM_LIT:10> , <NUM_LIT:10> ) , downscale = False ) == geom . Size ( <NUM_LIT:50> , <NUM_LIT:50> ) <EOL> assert geom . Size ( <NUM_LIT:50> , <NUM_LIT:50> ) . fit_inside ( ( <NUM_LIT:100> , <NUM_LIT:100> ) ) == geom . Size ( <NUM_LIT:100> , <NUM_LIT:100> ) <EOL> assert geom . Size ( <NUM_LIT:50> , <NUM_LIT:50> ) . fit_inside ( ( <NUM_LIT:200> , <NUM_LIT:100> ) ) == geom . Size ( <NUM_LIT:100> , <NUM_LIT:100> ) <EOL> assert geom . Size ( <NUM_LIT:50> , <NUM_LIT:50> ) . fit_inside ( ( <NUM_LIT:100> , <NUM_LIT:200> ) ) == geom . Size ( <NUM_LIT:100> , <NUM_LIT:100> ) <EOL> assert geom . Size ( <NUM_LIT:50> , <NUM_LIT:50> ) . fit_inside ( ( <NUM_LIT:100> , <NUM_LIT:100> ) , upscale = False ) == geom . Size ( <NUM_LIT:50> , <NUM_LIT:50> ) <EOL> assert geom . Size ( <NUM_LIT:50> , <NUM_LIT:50> ) . fit_inside ( ( <NUM_LIT:100> , <NUM_LIT:100> ) , downscale = False ) == geom . Size ( <NUM_LIT:100> , <NUM_LIT:100> ) <EOL> assert geom . Size ( <NUM_LIT> , <NUM_LIT> ) . fit_inside ( ( <NUM_LIT> , <NUM_LIT> ) ) == geom . Size ( <NUM_LIT> , <NUM_LIT> ) <EOL> assert geom . Size ( <NUM_LIT> , <NUM_LIT> ) . fit_inside ( ( <NUM_LIT> , <NUM_LIT> ) ) == geom . Size ( <NUM_LIT> , <NUM_LIT> ) <EOL> assert geom . Size ( <NUM_LIT> , <NUM_LIT> ) . fit_inside ( ( <NUM_LIT> , <NUM_LIT> ) ) == geom . Size ( <NUM_LIT> , <NUM_LIT> ) <EOL> def test_size_fit_around ( ) : <EOL> assert geom . Size ( <NUM_LIT:50> , <NUM_LIT:50> ) . fit_around ( ( <NUM_LIT:10> , <NUM_LIT:10> ) ) == geom . Size ( <NUM_LIT:10> , <NUM_LIT:10> ) <EOL> assert geom . Size ( <NUM_LIT:50> , <NUM_LIT:50> ) . fit_around ( ( <NUM_LIT:20> , <NUM_LIT:10> ) ) == geom . Size ( <NUM_LIT:20> , <NUM_LIT:20> ) <EOL> assert geom . Size ( <NUM_LIT:50> , <NUM_LIT:50> ) . fit_around ( ( <NUM_LIT:10> , <NUM_LIT:20> ) ) == geom . Size ( <NUM_LIT:20> , <NUM_LIT:20> ) <EOL> assert geom . Size ( <NUM_LIT:50> , <NUM_LIT:50> ) . fit_around ( ( <NUM_LIT:10> , <NUM_LIT:10> ) , upscale = False ) == geom . Size ( <NUM_LIT:10> , <NUM_LIT:10> ) <EOL> assert geom . Size ( <NUM_LIT:50> , <NUM_LIT:50> ) . fit_around ( ( <NUM_LIT:10> , <NUM_LIT:10> ) , downscale = False ) == geom . Size ( <NUM_LIT:50> , <NUM_LIT:50> ) <EOL> assert geom . Size ( <NUM_LIT:50> , <NUM_LIT:50> ) . fit_around ( ( <NUM_LIT:100> , <NUM_LIT:100> ) ) == geom . Size ( <NUM_LIT:100> , <NUM_LIT:100> ) <EOL> assert geom . Size ( <NUM_LIT:50> , <NUM_LIT:50> ) . fit_around ( ( <NUM_LIT:200> , <NUM_LIT:100> ) ) == geom . Size ( <NUM_LIT:200> , <NUM_LIT:200> ) <EOL> assert geom . Size ( <NUM_LIT:50> , <NUM_LIT:50> ) . fit_around ( ( <NUM_LIT:100> , <NUM_LIT:200> ) ) == geom . Size ( <NUM_LIT:200> , <NUM_LIT:200> ) <EOL> assert geom . Size ( <NUM_LIT:50> , <NUM_LIT:50> ) . fit_around ( ( <NUM_LIT:100> , <NUM_LIT:100> ) , upscale = False ) == geom . Size ( <NUM_LIT:50> , <NUM_LIT:50> ) <EOL> assert geom . Size ( <NUM_LIT:50> , <NUM_LIT:50> ) . fit_around ( ( <NUM_LIT:100> , <NUM_LIT:100> ) , downscale = False ) == geom . Size ( <NUM_LIT:100> , <NUM_LIT:100> ) <EOL> assert geom . Size ( <NUM_LIT> , <NUM_LIT> ) . fit_around ( ( <NUM_LIT> , <NUM_LIT> ) ) == geom . Size ( <NUM_LIT> , <NUM_LIT> ) <EOL> assert geom . Size ( <NUM_LIT> , <NUM_LIT> ) . fit_around ( ( <NUM_LIT> , <NUM_LIT> ) ) == geom . Size ( <NUM_LIT> , <NUM_LIT> ) <EOL> assert geom . Size ( <NUM_LIT> , <NUM_LIT> ) . fit_around ( ( <NUM_LIT> , <NUM_LIT> ) ) == geom . Size ( <NUM_LIT> , <NUM_LIT> ) <EOL> def test_rect_zero ( ) : <EOL> assert geom . Rectangle ( <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:10> , <NUM_LIT:10> ) <EOL> assert not geom . Rectangle ( <NUM_LIT:5> , <NUM_LIT:5> , <NUM_LIT:5> , <NUM_LIT:10> ) <EOL> assert not geom . Rectangle ( <NUM_LIT:5> , <NUM_LIT:10> , <NUM_LIT:5> , <NUM_LIT:5> ) <EOL> assert geom . Rectangle ( <NUM_LIT:5> , <NUM_LIT:5> , <NUM_LIT:10> , <NUM_LIT:10> ) <EOL> def test_rect_simple ( ) : <EOL> rect = geom . Rectangle ( <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:3> , <NUM_LIT:4> ) <EOL> assert rect . size == geom . Size ( <NUM_LIT:3> , <NUM_LIT:4> ) </s>
