<s> """<STR_LIT>""" <EOL> from django . test import TestCase <EOL> from django . template import Context <EOL> from django . core . paginator import Paginator <EOL> from zinnia . context import get_context_first_object <EOL> from zinnia . context import get_context_first_matching_object <EOL> from zinnia . context import get_context_loop_positions <EOL> class ContextTestCase ( TestCase ) : <EOL> """<STR_LIT>""" <EOL> def test_get_context_first_matching_object ( self ) : <EOL> context = Context ( { '<STR_LIT:a>' : <NUM_LIT:1> , '<STR_LIT:b>' : <NUM_LIT:2> , '<STR_LIT:c>' : <NUM_LIT:3> } ) <EOL> self . assertEqual ( <EOL> get_context_first_matching_object ( context , [ '<STR_LIT:key>' ] ) , <EOL> ( None , None ) ) <EOL> self . assertEqual ( <EOL> get_context_first_matching_object ( context , [ '<STR_LIT:a>' ] ) , <EOL> ( '<STR_LIT:a>' , <NUM_LIT:1> ) ) <EOL> self . assertEqual ( <EOL> get_context_first_matching_object ( context , [ '<STR_LIT:b>' , '<STR_LIT:a>' ] ) , <EOL> ( '<STR_LIT:b>' , <NUM_LIT:2> ) ) <EOL> def test_get_context_first_object ( self ) : <EOL> context = Context ( { '<STR_LIT:a>' : <NUM_LIT:1> , '<STR_LIT:b>' : <NUM_LIT:2> , '<STR_LIT:c>' : <NUM_LIT:3> } ) <EOL> self . assertEqual ( <EOL> get_context_first_object ( context , [ '<STR_LIT:key>' ] ) , <EOL> None ) <EOL> self . assertEqual ( <EOL> get_context_first_object ( context , [ '<STR_LIT:a>' ] ) , <EOL> <NUM_LIT:1> ) <EOL> self . assertEqual ( <EOL> get_context_first_object ( context , [ '<STR_LIT:b>' , '<STR_LIT:a>' ] ) , <EOL> <NUM_LIT:2> ) <EOL> def test_get_context_loop_positions ( self ) : <EOL> paginator = Paginator ( range ( <NUM_LIT:50> ) , <NUM_LIT:10> ) <EOL> context = Context ( { } ) <EOL> self . assertEqual ( <EOL> get_context_loop_positions ( context ) , <EOL> ( <NUM_LIT:0> , <NUM_LIT:0> ) ) <EOL> context = Context ( { '<STR_LIT>' : { '<STR_LIT>' : <NUM_LIT:5> } } ) <EOL> self . assertEqual ( <EOL> get_context_loop_positions ( context ) , <EOL> ( <NUM_LIT:5> , <NUM_LIT:5> ) ) <EOL> context = Context ( { '<STR_LIT>' : { '<STR_LIT>' : <NUM_LIT:5> } , <EOL> '<STR_LIT>' : paginator . page ( <NUM_LIT:3> ) } ) <EOL> self . assertEqual ( <EOL> get_context_loop_positions ( context ) , <EOL> ( <NUM_LIT> , <NUM_LIT:5> ) ) </s>
