<s> from mock import MagicMock <EOL> from tests . base_test_case import BaseTestCase <EOL> from radiotherm . fields import Field <EOL> class TestBuildGetReturn ( BaseTestCase ) : <EOL> INT_RETURN_VALUE = { '<STR_LIT>' : <NUM_LIT:1> } <EOL> NO_NAME_RETURN_VALUE = <NUM_LIT> <EOL> def test_with_name ( self ) : <EOL> field = Field ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> ret = field . _build_get_return ( self . INT_RETURN_VALUE ) <EOL> self . assertTrue ( '<STR_LIT>' in ret ) <EOL> self . assertEqual ( len ( ret ) , <NUM_LIT:1> ) <EOL> self . assertEqual ( ret [ '<STR_LIT>' ] , self . INT_RETURN_VALUE [ '<STR_LIT>' ] ) <EOL> def test_without_name ( self ) : <EOL> field = Field ( '<STR_LIT>' , None ) <EOL> ret = field . _build_get_return ( self . NO_NAME_RETURN_VALUE ) <EOL> self . assertTrue ( '<STR_LIT>' in ret ) <EOL> self . assertEqual ( len ( ret ) , <NUM_LIT:1> ) <EOL> self . assertEqual ( ret [ '<STR_LIT>' ] , self . NO_NAME_RETURN_VALUE ) <EOL> def test_with_human ( self ) : <EOL> field = Field ( '<STR_LIT>' , '<STR_LIT>' , { <NUM_LIT:0> : '<STR_LIT>' , <NUM_LIT:1> : '<STR_LIT>' } ) <EOL> field . _convert_to_human = MagicMock ( return_value = '<STR_LIT>' ) <EOL> ret = field . _build_get_return ( self . INT_RETURN_VALUE ) <EOL> self . assertTrue ( '<STR_LIT>' in ret ) <EOL> self . assertTrue ( '<STR_LIT>' in ret ) <EOL> self . assertEqual ( ret [ '<STR_LIT>' ] , '<STR_LIT>' ) </s>
