<s> from django . test import TestCase <EOL> from . models import Translation <EOL> from . helpers import _ <EOL> def create_translation ( ) : <EOL> return ( Translation . objects . create ( language = '<STR_LIT>' , <EOL> source = "<STR_LIT>" , <EOL> trans = "<STR_LIT>" ) , <EOL> Translation . objects . create ( language = '<STR_LIT>' , <EOL> source = "<STR_LIT>" , <EOL> trans = "<STR_LIT>" , <EOL> context = "<STR_LIT>" ) <EOL> ) <EOL> class ModelTest ( TestCase ) : <EOL> def setUp ( self ) : <EOL> self . trans , self . trans2 = create_translation ( ) <EOL> def test_translate ( self ) : <EOL> self . assertEqual ( <EOL> Translation . objects . translate ( "<STR_LIT>" , '<STR_LIT>' ) [ <NUM_LIT:0> ] . trans , <EOL> "<STR_LIT>" ) <EOL> def test_context ( self ) : <EOL> self . assertEqual ( <EOL> Translation . objects . translate ( "<STR_LIT>" , '<STR_LIT>' , <EOL> context = '<STR_LIT>' ) [ <NUM_LIT:0> ] . trans , <EOL> "<STR_LIT>" ) <EOL> def test_uid_generated ( self ) : <EOL> self . assertEqual ( self . trans . uid , "<STR_LIT>" , <EOL> "<STR_LIT>" ) <EOL> class HelperTest ( TestCase ) : <EOL> def setUp ( self ) : <EOL> Translation . objects . create ( language = '<STR_LIT>' , <EOL> source = "<STR_LIT>" , <EOL> trans = "<STR_LIT>" ) <EOL> Translation . objects . create ( language = '<STR_LIT>' , <EOL> source = "<STR_LIT>" , <EOL> trans = "<STR_LIT>" ) <EOL> def test_underscore ( self ) : <EOL> self . assertEqual ( _ ( "<STR_LIT>" ) , "<STR_LIT>" ) <EOL> def test_not_found ( self ) : <EOL> self . assertEqual ( _ ( "<STR_LIT>" , '<STR_LIT>' ) , "<STR_LIT>" ) <EOL> def test_blank ( self ) : <EOL> self . assertEqual ( _ ( "<STR_LIT>" ) , "<STR_LIT>" ) </s>
