<s> from pyvows import Vows , expect <EOL> from thumbor . point import FocalPoint <EOL> @ Vows . batch <EOL> class FocalPointVows ( Vows . Context ) : <EOL> class DefaultAlignmentPercentages ( Vows . Context ) : <EOL> def topic ( self ) : <EOL> return FocalPoint . ALIGNMENT_PERCENTAGES <EOL> def should_have_left_alignment_of_0 ( self , topic ) : <EOL> expect ( topic [ '<STR_LIT:left>' ] ) . to_equal ( <NUM_LIT:0.0> ) <EOL> def should_have_center_alignment_of_half ( self , topic ) : <EOL> expect ( topic [ '<STR_LIT>' ] ) . to_equal ( <NUM_LIT:0.5> ) <EOL> def should_have_right_alignment_of_one ( self , topic ) : <EOL> expect ( topic [ '<STR_LIT:right>' ] ) . to_equal ( <NUM_LIT:1.0> ) <EOL> def should_have_top_alignment_of_0 ( self , topic ) : <EOL> expect ( topic [ '<STR_LIT>' ] ) . to_equal ( <NUM_LIT:0.0> ) <EOL> def should_have_middle_alignment_of_half ( self , topic ) : <EOL> expect ( topic [ '<STR_LIT>' ] ) . to_equal ( <NUM_LIT:0.5> ) <EOL> def should_have_bottom_alignment_of_one ( self , topic ) : <EOL> expect ( topic [ '<STR_LIT>' ] ) . to_equal ( <NUM_LIT:1.0> ) <EOL> class NewPoint ( Vows . Context ) : <EOL> class DefaultWeight ( Vows . Context ) : <EOL> def topic ( self ) : <EOL> return FocalPoint ( <NUM_LIT:10> , <NUM_LIT:20> ) <EOL> def should_have_x_coord_of_10 ( self , topic ) : <EOL> expect ( topic . x ) . to_equal ( <NUM_LIT:10> ) <EOL> def should_have_y_coord_of_20 ( self , topic ) : <EOL> expect ( topic . y ) . to_equal ( <NUM_LIT:20> ) <EOL> class Weighted ( Vows . Context ) : <EOL> def topic ( self ) : <EOL> return FocalPoint ( x = <NUM_LIT:10> , y = <NUM_LIT:20> , height = <NUM_LIT:1.0> , width = <NUM_LIT> , weight = <NUM_LIT> ) <EOL> def should_have_weight_of_three ( self , topic ) : <EOL> expect ( topic . weight ) . to_equal ( <NUM_LIT> ) <EOL> def should_have_proper_representation ( self , topic ) : <EOL> expect ( str ( topic ) ) . to_equal ( '<STR_LIT>' ) <EOL> class FromDict ( Vows . Context ) : <EOL> def topic ( self ) : <EOL> return FocalPoint . from_dict ( { '<STR_LIT:x>' : <NUM_LIT> , '<STR_LIT:y>' : <NUM_LIT> , '<STR_LIT:z>' : <NUM_LIT> } ) <EOL> def should_have_x_coord_of_10_1 ( self , topic ) : <EOL> expect ( topic . x ) . to_equal ( <NUM_LIT> ) <EOL> def should_have_y_coord_of_20_1 ( self , topic ) : <EOL> expect ( topic . y ) . to_equal ( <NUM_LIT> ) <EOL> def should_have_weight_of_5_1 ( self , topic ) : <EOL> expect ( topic . weight ) . to_equal ( <NUM_LIT> ) <EOL> class ToDict ( Vows . Context ) : <EOL> def topic ( self , prev_topic ) : <EOL> return prev_topic . to_dict ( ) <EOL> def should_create_the_original_dictionary ( self , topic ) : <EOL> expect ( topic ) . to_be_like ( { '<STR_LIT:x>' : <NUM_LIT> , '<STR_LIT:y>' : <NUM_LIT> , '<STR_LIT:z>' : <NUM_LIT> , '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT:width>' : <NUM_LIT:1.0> , '<STR_LIT>' : <NUM_LIT:1.0> } ) <EOL> class SquarePoint ( Vows . Context ) : <EOL> def topic ( self ) : <EOL> return FocalPoint . from_square ( x = <NUM_LIT> , y = <NUM_LIT:50> , width = <NUM_LIT> , height = <NUM_LIT> ) <EOL> def should_have_x_of_450 ( self , topic ) : <EOL> expect ( topic . x ) . to_equal ( <NUM_LIT> ) <EOL> def should_have_x_of_150 ( self , topic ) : <EOL> expect ( topic . y ) . to_equal ( <NUM_LIT> ) <EOL> def should_have_weight_of_12100 ( self , topic ) : <EOL> expect ( topic . weight ) . to_equal ( <NUM_LIT> ) <EOL> class AlignedPoint ( Vows . Context ) : <EOL> class CenterMiddle ( Vows . Context ) : <EOL> def topic ( self ) : <EOL> return FocalPoint . from_alignment ( '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT> , <NUM_LIT:200> ) <EOL> def should_have_x_of_150 ( self , topic ) : <EOL> expect ( topic . x ) . to_equal ( <NUM_LIT> ) <EOL> def should_have_y_of_100 ( self , topic ) : <EOL> expect ( topic . y ) . to_equal ( <NUM_LIT:100> ) <EOL> def should_have_weight_of_1 ( self , topic ) : <EOL> expect ( topic . weight ) . to_equal ( <NUM_LIT:1.0> ) <EOL> class TopLeft ( Vows . Context ) : <EOL> def topic ( self ) : <EOL> return FocalPoint . from_alignment ( '<STR_LIT:left>' , '<STR_LIT>' , <NUM_LIT> , <NUM_LIT:200> ) <EOL> def should_have_x_of_0 ( self , topic ) : <EOL> expect ( topic . x ) . to_equal ( <NUM_LIT:0> ) <EOL> def should_have_y_of_0 ( self , topic ) : <EOL> expect ( topic . y ) . to_equal ( <NUM_LIT:0> ) <EOL> def should_have_weight_of_1 ( self , topic ) : <EOL> expect ( topic . weight ) . to_equal ( <NUM_LIT:1.0> ) <EOL> class BottomRight ( Vows . Context ) : <EOL> def topic ( self ) : <EOL> return FocalPoint . from_alignment ( '<STR_LIT:right>' , '<STR_LIT>' , <NUM_LIT> , <NUM_LIT:200> ) <EOL> def should_have_x_of_300 ( self , topic ) : <EOL> expect ( topic . x ) . to_equal ( <NUM_LIT> ) <EOL> def should_have_y_of_200 ( self , topic ) : <EOL> expect ( topic . y ) . to_equal ( <NUM_LIT:200> ) <EOL> def should_have_weight_of_1 ( self , topic ) : <EOL> expect ( topic . weight ) . to_equal ( <NUM_LIT:1.0> ) </s>
