<s> from . testmodels import DecimalModel <EOL> from django . test import TestCase <EOL> from decimal import Decimal , InvalidOperation <EOL> D = Decimal <EOL> class DecimalTest ( TestCase ) : <EOL> DECIMALS = D ( "<STR_LIT>" ) , D ( "<STR_LIT:5>" ) , D ( "<STR_LIT>" ) , D ( "<STR_LIT>" ) , D ( "<STR_LIT>" ) <EOL> def setUp ( self ) : <EOL> for d in self . DECIMALS : <EOL> DecimalModel ( decimal = d ) . save ( ) <EOL> def test_filter ( self ) : <EOL> d = DecimalModel . objects . get ( decimal = D ( "<STR_LIT>" ) ) <EOL> self . assertTrue ( isinstance ( d . decimal , Decimal ) ) <EOL> self . assertEquals ( str ( d . decimal ) , "<STR_LIT>" ) <EOL> d = DecimalModel . objects . get ( decimal = D ( "<STR_LIT>" ) ) <EOL> self . assertEquals ( str ( d . decimal ) , "<STR_LIT>" ) <EOL> d = DecimalModel . objects . get ( decimal = "<STR_LIT>" ) <EOL> self . assertEquals ( str ( d . decimal ) , "<STR_LIT>" ) <EOL> def test_order ( self ) : <EOL> rows = DecimalModel . objects . all ( ) . order_by ( '<STR_LIT>' ) <EOL> values = list ( d . decimal for d in rows ) <EOL> self . assertEquals ( values , sorted ( values ) ) <EOL> def test_sign_extend ( self ) : <EOL> DecimalModel ( decimal = D ( '<STR_LIT>' ) ) . save ( ) <EOL> try : <EOL> DecimalModel . objects . filter ( decimal__lt = <NUM_LIT:1> ) [ <NUM_LIT:0> ] <EOL> except InvalidOperation : <EOL> self . assertTrue ( False ) </s>
