<s> from django . contrib . sites . models import Site <EOL> from oembed . tests . tests . base import BaseOEmbedTestCase <EOL> from oembed . utils import size_to_nearest , relative_to_full , load_class , cleaned_sites , scale <EOL> class OEmbedUtilsTestCase ( BaseOEmbedTestCase ) : <EOL> def test_size_to_nearest ( self ) : <EOL> sizes = ( ( <NUM_LIT:100> , <NUM_LIT:100> ) , ( <NUM_LIT:200> , <NUM_LIT:200> ) , ( <NUM_LIT> , <NUM_LIT> ) ) <EOL> self . assertEqual ( ( <NUM_LIT> , <NUM_LIT:200> ) , size_to_nearest ( <NUM_LIT> , <NUM_LIT:200> , sizes , False ) ) <EOL> self . assertEqual ( ( <NUM_LIT:100> , <NUM_LIT:100> ) , size_to_nearest ( <NUM_LIT:100> , <NUM_LIT:100> , sizes , False ) ) <EOL> self . assertEqual ( ( <NUM_LIT:200> , <NUM_LIT> ) , size_to_nearest ( <NUM_LIT> , <NUM_LIT> , sizes , False ) ) <EOL> self . assertEqual ( ( <NUM_LIT:100> , <NUM_LIT> ) , size_to_nearest ( <NUM_LIT> , None , sizes , False ) ) <EOL> self . assertEqual ( ( <NUM_LIT> , <NUM_LIT:100> ) , size_to_nearest ( None , <NUM_LIT> , sizes , False ) ) <EOL> self . assertEqual ( ( <NUM_LIT:100> , <NUM_LIT:100> ) , size_to_nearest ( <NUM_LIT> , None , sizes , True ) ) <EOL> self . assertEqual ( ( <NUM_LIT:100> , <NUM_LIT:100> ) , size_to_nearest ( None , <NUM_LIT> , sizes , True ) ) <EOL> self . assertEqual ( ( <NUM_LIT:200> , <NUM_LIT:200> ) , size_to_nearest ( <NUM_LIT> , None , sizes , True ) ) <EOL> self . assertEqual ( ( <NUM_LIT:200> , <NUM_LIT:200> ) , size_to_nearest ( None , <NUM_LIT> , sizes , True ) ) <EOL> self . assertEqual ( ( <NUM_LIT> , <NUM_LIT> ) , size_to_nearest ( None , None , sizes , False ) ) <EOL> self . assertEqual ( ( <NUM_LIT> , <NUM_LIT> ) , size_to_nearest ( None , None , sizes , True ) ) <EOL> self . assertEqual ( ( <NUM_LIT:100> , <NUM_LIT> ) , size_to_nearest ( <NUM_LIT:50> , <NUM_LIT> , sizes , False ) ) <EOL> self . assertEqual ( ( <NUM_LIT:100> , <NUM_LIT:100> ) , size_to_nearest ( <NUM_LIT:50> , <NUM_LIT> , sizes , True ) ) <EOL> self . assertEqual ( ( <NUM_LIT:100> , <NUM_LIT> ) , size_to_nearest ( <NUM_LIT:50> , None , sizes , False ) ) <EOL> self . assertEqual ( ( <NUM_LIT:100> , <NUM_LIT:100> ) , size_to_nearest ( <NUM_LIT:50> , None , sizes , True ) ) <EOL> self . assertEqual ( ( <NUM_LIT:200> , <NUM_LIT:200> ) , size_to_nearest ( <NUM_LIT> , <NUM_LIT:200> , sizes , True ) ) <EOL> self . assertEqual ( ( <NUM_LIT:100> , <NUM_LIT:100> ) , size_to_nearest ( <NUM_LIT:100> , <NUM_LIT:100> , sizes , True ) ) <EOL> self . assertEqual ( ( <NUM_LIT:200> , <NUM_LIT:200> ) , size_to_nearest ( <NUM_LIT> , <NUM_LIT> , sizes , True ) ) <EOL> self . assertEqual ( ( <NUM_LIT:100> , <NUM_LIT:100> ) , size_to_nearest ( <NUM_LIT:100> , None , sizes , True ) ) <EOL> self . assertEqual ( ( <NUM_LIT:100> , <NUM_LIT:100> ) , size_to_nearest ( None , <NUM_LIT:100> , sizes , True ) ) <EOL> def test_size_to_nearest_defaults ( self ) : <EOL> self . assertEqual ( ( <NUM_LIT> , <NUM_LIT> ) , size_to_nearest ( <NUM_LIT> , <NUM_LIT> ) ) <EOL> self . assertEqual ( ( <NUM_LIT> , <NUM_LIT> ) , size_to_nearest ( <NUM_LIT> , <NUM_LIT> ) ) <EOL> self . assertEqual ( ( <NUM_LIT> , <NUM_LIT> ) , size_to_nearest ( None , <NUM_LIT> ) ) <EOL> self . assertEqual ( ( <NUM_LIT> , <NUM_LIT> ) , size_to_nearest ( <NUM_LIT> , None ) ) <EOL> self . assertEqual ( ( <NUM_LIT> , <NUM_LIT> ) , size_to_nearest ( None , <NUM_LIT> ) ) <EOL> self . assertEqual ( ( <NUM_LIT> , <NUM_LIT> ) , size_to_nearest ( <NUM_LIT> , None ) ) <EOL> self . assertEqual ( ( <NUM_LIT:200> , <NUM_LIT:200> ) , size_to_nearest ( <NUM_LIT> , <NUM_LIT> , force_fit = True ) ) <EOL> def test_relative_to_full ( self ) : <EOL> self . assertEqual ( '<STR_LIT>' , relative_to_full ( '<STR_LIT>' , '<STR_LIT>' ) ) <EOL> self . assertEqual ( '<STR_LIT>' , relative_to_full ( '<STR_LIT>' , '<STR_LIT>' ) ) <EOL> self . assertEqual ( '<STR_LIT>' , relative_to_full ( '<STR_LIT>' , '<STR_LIT>' ) ) <EOL> self . assertEqual ( '<STR_LIT>' , relative_to_full ( '<STR_LIT>' , '<STR_LIT>' ) ) <EOL> self . assertEqual ( '<STR_LIT>' , relative_to_full ( '<STR_LIT>' , '<STR_LIT>' ) ) <EOL> def test_load_class ( self ) : <EOL> parser_class = load_class ( '<STR_LIT>' ) <EOL> self . assertEqual ( parser_class . __name__ , '<STR_LIT>' ) <EOL> self . assertEqual ( parser_class . __module__ , '<STR_LIT>' ) <EOL> def test_cleaned_sites ( self ) : <EOL> sites = Site . objects . all ( ) <EOL> cleaned = cleaned_sites ( ) <EOL> example = cleaned [ <NUM_LIT:1> ] <EOL> self . assertEquals ( example [ <NUM_LIT:1> ] , '<STR_LIT>' ) <EOL> self . assertEquals ( example [ <NUM_LIT:2> ] , '<STR_LIT>' ) <EOL> self . assertEquals ( example [ <NUM_LIT:0> ] , '<STR_LIT>' ) <EOL> www2_site = Site . objects . create ( name = '<STR_LIT>' , domain = '<STR_LIT>' ) <EOL> mobile_site = Site . objects . create ( name = '<STR_LIT>' , domain = '<STR_LIT>' ) <EOL> cleaned = cleaned_sites ( ) <EOL> self . assertEquals ( cleaned [ www2_site . pk ] [ <NUM_LIT:1> ] , '<STR_LIT>' ) <EOL> self . assertEquals ( cleaned [ www2_site . pk ] [ <NUM_LIT:2> ] , '<STR_LIT>' ) <EOL> self . assertEquals ( cleaned [ www2_site . pk ] [ <NUM_LIT:0> ] , '<STR_LIT>' ) <EOL> self . assertEquals ( cleaned [ mobile_site . pk ] [ <NUM_LIT:1> ] , '<STR_LIT>' ) <EOL> self . assertEquals ( cleaned [ mobile_site . pk ] [ <NUM_LIT:2> ] , '<STR_LIT>' ) <EOL> self . assertEquals ( cleaned [ mobile_site . pk ] [ <NUM_LIT:0> ] , '<STR_LIT>' ) <EOL> def test_scale ( self ) : <EOL> self . assertEqual ( scale ( <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ) , ( <NUM_LIT> , <NUM_LIT> ) ) <EOL> self . assertEqual ( scale ( <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ) , ( <NUM_LIT> , <NUM_LIT> ) ) <EOL> self . assertEqual ( scale ( <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ) , ( <NUM_LIT> , <NUM_LIT> ) ) <EOL> self . assertEqual ( scale ( <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ) , ( <NUM_LIT> , <NUM_LIT> ) ) <EOL> self . assertEqual ( scale ( <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ) , ( <NUM_LIT> , <NUM_LIT> ) ) <EOL> self . assertEqual ( scale ( <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ) , ( <NUM_LIT> , <NUM_LIT> ) ) </s>
