<s> """<STR_LIT>""" <EOL> from unittest import TestCase <EOL> from django . core . exceptions import SuspiciousOperation <EOL> from django . http import HttpRequest <EOL> from djangoflash . context_processors import CONTEXT_VAR , flash <EOL> from djangoflash . models import FlashScope <EOL> class FlashContextProcessorTestCase ( TestCase ) : <EOL> """<STR_LIT>""" <EOL> def setUp ( self ) : <EOL> self . request = HttpRequest ( ) <EOL> self . scope = FlashScope ( ) ; <EOL> setattr ( self . request , CONTEXT_VAR , self . scope ) ; <EOL> def test_expose_flash ( self ) : <EOL> """<STR_LIT>""" <EOL> self . assertEqual ( flash ( self . request ) , { CONTEXT_VAR : self . scope } ) <EOL> def test_expose_inexistent_flash ( self ) : <EOL> """<STR_LIT>""" <EOL> delattr ( self . request , CONTEXT_VAR ) <EOL> self . assertTrue ( isinstance ( flash ( self . request ) [ CONTEXT_VAR ] , FlashScope ) ) <EOL> def test_expose_invalid_flash ( self ) : <EOL> """<STR_LIT>""" <EOL> self . request . flash = '<STR_LIT>' <EOL> self . assertRaises ( SuspiciousOperation , flash , self . request ) </s>
