<s> from django . test import TestCase <EOL> from regressiontests . reverse_single_related . models import * <EOL> class ReverseSingleRelatedTests ( TestCase ) : <EOL> """<STR_LIT>""" <EOL> def test_reverse_single_related ( self ) : <EOL> public_source = Source . objects . create ( is_public = True ) <EOL> public_item = Item . objects . create ( source = public_source ) <EOL> private_source = Source . objects . create ( is_public = False ) <EOL> private_item = Item . objects . create ( source = private_source ) <EOL> self . assertQuerysetEqual ( <EOL> Source . objects . all ( ) , <EOL> [ "<STR_LIT>" ] <EOL> ) <EOL> self . assertEqual ( public_item . source , public_source ) <EOL> self . assertEqual ( private_item . source , private_source ) <EOL> Source . objects . use_for_related_fields = True <EOL> private_item = Item . objects . get ( pk = private_item . pk ) <EOL> self . assertRaises ( Source . DoesNotExist , lambda : private_item . source ) </s>
