From 7fac623f859fb3fe168fca2314b2129f86bd648f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Fri, 31 Jan 2014 00:04:20 +0100 Subject: [PATCH] Drop support of Python 2.6 review2691002 --- INSTALL | 2 +- setup.py | 1 - tests/scenario_stock_average_cost_price.rst | 8 +++---- tests/test_stock.py | 26 ++++++++------------- 4 files changed, 15 insertions(+), 22 deletions(-) diff --git a/INSTALL b/INSTALL index 3902b76453..1f11ac29f1 100644 --- a/INSTALL +++ b/INSTALL @@ -4,7 +4,7 @@ Installing trytond_stock Prerequisites ------------- - * Python 2.6 or later (http://www.python.org/) + * Python 2.7 or later (http://www.python.org/) * trytond (http://www.tryton.org/) * python-sql (http://code.google.com/p/python-sql/) * trytond_party (http://www.tryton.org/) diff --git a/setup.py b/setup.py index 0ca2154b00..1b7458bb67 100644 --- a/setup.py +++ b/setup.py @@ -70,7 +70,6 @@ setup(name='trytond_stock', 'Natural Language :: Slovenian', 'Natural Language :: Spanish', 'Operating System :: OS Independent', - 'Programming Language :: Python :: 2.6', 'Programming Language :: Python :: 2.7', 'Topic :: Office/Business', ], diff --git a/tests/scenario_stock_average_cost_price.rst b/tests/scenario_stock_average_cost_price.rst index d638797d32..3423ecbcab 100644 --- a/tests/scenario_stock_average_cost_price.rst +++ b/tests/scenario_stock_average_cost_price.rst @@ -101,8 +101,8 @@ Make 1 unit of the product available @ 100 :: Check Cost Price is 100:: >>> product.reload() - >>> product.template.cost_price == Decimal('100') - True + >>> product.template.cost_price + Decimal('100.0000') Add 1 more unit @ 200:: @@ -123,5 +123,5 @@ Add 1 more unit @ 200:: Check Cost Price Average is 150:: >>> product.reload() - >>> product.template.cost_price == Decimal('150') - True + >>> product.template.cost_price + Decimal('150.0000') diff --git a/tests/test_stock.py b/tests/test_stock.py index 6154756ed5..9671dbd75e 100644 --- a/tests/test_stock.py +++ b/tests/test_stock.py @@ -264,12 +264,6 @@ class StockTestCase(unittest.TestCase): else: self.assertEqual(product_reloaded.quantity, quantity) - # Python 2.6 compatibility (assertIn and assertNotIn added in 2.7) - assertIn = getattr(self, 'assertIn', - lambda a, b: self.assertTrue(a in b)) - assertNotIn = getattr(self, 'assertNotIn', - lambda a, b: self.assertTrue(a not in b)) - def tests_product_search_quantity(context, quantity): with transaction.set_context(locations=[storage.id]): if (not context.get('stock_date_end') @@ -281,50 +275,50 @@ class StockTestCase(unittest.TestCase): found_products = self.product.search([ (fname, '=', quantity), ]) - assertIn(product, found_products) + self.assertIn(product, found_products) found_products = self.product.search([ (fname, '!=', quantity), ]) - assertNotIn(product, found_products) + self.assertNotIn(product, found_products) found_products = self.product.search([ (fname, 'in', (quantity, quantity + 1)), ]) - assertIn(product, found_products) + self.assertIn(product, found_products) found_products = self.product.search([ (fname, 'not in', (quantity, quantity + 1)), ]) - assertNotIn(product, found_products) + self.assertNotIn(product, found_products) found_products = self.product.search([ (fname, '<', quantity), ]) - assertNotIn(product, found_products) + self.assertNotIn(product, found_products) found_products = self.product.search([ (fname, '<', quantity + 1), ]) - assertIn(product, found_products) + self.assertIn(product, found_products) found_products = self.product.search([ (fname, '>', quantity), ]) - assertNotIn(product, found_products) + self.assertNotIn(product, found_products) found_products = self.product.search([ (fname, '>', quantity - 1), ]) - assertIn(product, found_products) + self.assertIn(product, found_products) found_products = self.product.search([ (fname, '>=', quantity), ]) - assertIn(product, found_products) + self.assertIn(product, found_products) found_products = self.product.search([ (fname, '<=', quantity), ]) - assertIn(product, found_products) + self.assertIn(product, found_products) def test_products_by_location(): for context, quantity in tests: