Drop support of Python 2.6
review2691002
This commit is contained in:
@@ -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/)
|
||||
|
||||
@@ -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',
|
||||
],
|
||||
|
||||
@@ -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')
|
||||
|
||||
+10
-16
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user