From 7b6e750d285a51f8d226d49ff1e6eec4ac0fa2ec Mon Sep 17 00:00:00 2001 From: Matthias Mair Date: Mon, 3 Aug 2026 23:55:35 +0200 Subject: [PATCH 1/2] add addersts to fix type checking --- test/test_order.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/test/test_order.py b/test/test_order.py index cd5e3fc..9d32471 100644 --- a/test/test_order.py +++ b/test/test_order.py @@ -90,6 +90,7 @@ def test_po_create(self): reference=ref, description="This is a PO created using the Python interface" ) + assert po self.assertIsNotNone(po) self.assertIsNotNone(po.pk) @@ -119,6 +120,7 @@ def test_po_create(self): continue line = po.addLineItem(part=sp.pk, quantity=idx) + assert line self.assertEqual(line.getOrder().pk, po.pk) @@ -147,7 +149,7 @@ def test_po_create(self): # Let's add some! extraline = po.addExtraLineItem(quantity=1, reference="Transport costs", notes="Extra line item added from Python interface", price=10, price_currency="EUR") - + assert extraline self.assertEqual(extraline.getOrder().pk, po.pk) self.assertIsNotNone(extraline) @@ -173,6 +175,7 @@ def test_order_cancel(self): 'reference': ref, 'description': 'Some new order' }) + assert po self.assertEqual(po.status, 10) self.assertEqual(po.status_text, "Pending") @@ -196,6 +199,7 @@ def test_order_complete_with_receive(self): 'reference': ref, 'description': 'A purchase order with items to be received', }) + assert po # Get first location use_location = stock.StockLocation.list(self.api, limit=1)[0] @@ -267,6 +271,7 @@ def test_order_complete_with_receive(self): # Receive all line items # Use the ID of the location here result = po.receiveAll(location=use_location.pk) + assert result # Check the result returned if self.api.api_version < 385: # Ref: https://github.com/inventree/InvenTree/pull/10174/ @@ -306,6 +311,7 @@ def test_order_complete(self): 'reference': ref, 'description': 'A new purchase order', }) + assert po # Add some line items for p in company.SupplierPart.list(self.api, supplier=1, limit=5): @@ -377,6 +383,7 @@ def test_po_attachment(self): 'reference': f'PO-{n + 100}', 'description': 'A new purchase order', }) + assert po attachments = po.getAttachments() self.assertEqual(len(attachments), 0) @@ -558,6 +565,7 @@ def test_so_attachment(self): 'customer': 4, "description": "Selling some stuff", }) + assert so n = len(so.getAttachments()) @@ -584,6 +592,7 @@ def test_so_shipment(self): 'customer': 4, "description": "Selling some stuff", }) + assert so # Add some line items to the SalesOrder for p in part.Part.list(self.api, is_template=False, salable=True, limit=5): @@ -645,6 +654,7 @@ def test_so_shipment(self): shipment_2 = so.addShipment(f'Package {num_shipments + 1}') # Assert the shipment is not created + assert shipment_2 self.assertIsNotNone(shipment_2) # Assert the shipment Order is equal to the expected one @@ -671,6 +681,7 @@ def test_so_shipment(self): ) # Assert the shipment is created + assert shipment_2 self.assertIsNotNone(shipment_2) # Assert the shipment Order is equal to the expected one @@ -790,6 +801,7 @@ def test_ro_create(self): reference=ref, description="A new return order" ) + assert ro self.assertIsNotNone(ro) self.assertIsNotNone(ro.pk) From 8feca42975ab4357c0a55ef85ab0cc48f5fffce3 Mon Sep 17 00:00:00 2001 From: Matthias Mair Date: Mon, 3 Aug 2026 23:57:41 +0200 Subject: [PATCH 2/2] remove unneeded switch --- test/test_order.py | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/test/test_order.py b/test/test_order.py index 9d32471..ce5fcba 100644 --- a/test/test_order.py +++ b/test/test_order.py @@ -289,14 +289,8 @@ def test_order_complete_with_receive(self): result = po.receiveAll(location=use_location) self.assertIsNone(result) - # hold the order, then complete it - po._statusupdate(status='hold') - - # Complete the order, do not accept any incomplete lines - po.complete(accept_incomplete=False) - po.reload() - # Check that the order is now complete + po.reload() self.assertEqual(po.status, 30) def test_order_complete(self):