Reviewers: ,


Please review this at http://codereview.tryton.org/163009/

Affected files:
  M currency.py
  M tests/test_currency.py


Index: currency.py
===================================================================

--- a/currency.py
+++ b/currency.py
@@ -1,6 +1,5 @@
 #This file is part of Tryton.  The COPYRIGHT file at the top level
 #of this repository contains the full copyright notices and license terms.
-import time
 import datetime
 from decimal import Decimal, ROUND_HALF_EVEN
 from trytond.model import ModelView, ModelSQL, fields

Index: tests/test_currency.py
===================================================================

--- a/tests/test_currency.py
+++ b/tests/test_currency.py
@@ -69,7 +69,7 @@
         '''
         Check grouping
         '''
-        with Transaction().start(DB_NAME, USER, CONTEXT) as transaction:
+        with Transaction().start(DB_NAME, USER, CONTEXT):
             cu1_id = self.get_currency('cu1')

             self.assertRaises(Exception, self.currency.write, cu1_id,
@@ -123,7 +123,7 @@
                 'code': 'cu'
                 })

-            rate1_id = self.rate.create({
+            self.rate.create({
                 'rate': Decimal("1.3"),
                 'currency': cu_id,
                 'date': today,
@@ -157,7 +157,7 @@
         '''
         Conversion with rounding on non-finite decimal representation
         '''
-        with Transaction().start(DB_NAME, USER, CONTEXT) as transaction:
+        with Transaction().start(DB_NAME, USER, CONTEXT):
             cu1_id = self.get_currency('cu1')
             cu2_id = self.get_currency('cu2')

@@ -171,7 +171,7 @@
         '''
         Same without rounding
         '''
-        with Transaction().start(DB_NAME, USER, CONTEXT) as transaction:
+        with Transaction().start(DB_NAME, USER, CONTEXT):
             cu1_id = self.get_currency('cu1')
             cu2_id = self.get_currency('cu2')

@@ -185,7 +185,7 @@
         '''
         Conversion to the same currency
         '''
-        with Transaction().start(DB_NAME, USER, CONTEXT) as transaction:
+        with Transaction().start(DB_NAME, USER, CONTEXT):
             cu1_id = self.get_currency('cu1')

             amount = Decimal("10")
@@ -197,11 +197,10 @@
         '''
         Conversion with zero amount
         '''
-        with Transaction().start(DB_NAME, USER, CONTEXT) as transaction:
+        with Transaction().start(DB_NAME, USER, CONTEXT):
             cu1_id = self.get_currency('cu1')
             cu2_id = self.get_currency('cu2')
-
-            amount = Decimal("10")
+
             expected = Decimal("0")
             converted_amount = self.currency.compute(
                     cu1_id, Decimal("0"), cu2_id, True)



--
[email protected] mailing list

Reply via email to