2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-07-03 04:00:57 +00:00
* bump deps

* use isinstance where possible

* and another bump ;-)

* small fix for isinstance

* fixed wrong comparison

* fixed comparision

* use exact comparision
This commit is contained in:
Matthias Mair
2023-08-06 13:39:15 +02:00
committed by GitHub
parent 54e0e47c6a
commit 879d496e26
11 changed files with 31 additions and 31 deletions

View File

@ -377,7 +377,7 @@ class BuildReport(ReportTemplateBase):
"""Custom context data for the build report."""
my_build = self.object_to_print
if type(my_build) != build.models.Build:
if not isinstance(my_build, build.models.Build):
raise TypeError('Provided model is not a Build object')
return {
@ -653,7 +653,7 @@ class StockLocationReport(ReportTemplateBase):
"""Return custom context data for the StockLocationReport template"""
stock_location = self.object_to_print
if type(stock_location) != stock.models.StockLocation:
if not isinstance(stock_location, stock.models.StockLocation):
raise TypeError('Provided model is not a StockLocation object -> ' + str(type(stock_location)))
return {

View File

@ -168,12 +168,12 @@ class BarcodeTagTest(TestCase):
barcode = barcode_tags.barcode("12345")
self.assertTrue(type(barcode) == str)
self.assertTrue(isinstance(barcode, str))
self.assertTrue(barcode.startswith('data:image/png;'))
# Try with a different format
barcode = barcode_tags.barcode('99999', format='BMP')
self.assertTrue(type(barcode) == str)
self.assertTrue(isinstance(barcode, str))
self.assertTrue(barcode.startswith('data:image/bmp;'))
def test_qrcode(self):
@ -181,7 +181,7 @@ class BarcodeTagTest(TestCase):
# Test with default settings
qrcode = barcode_tags.qrcode("hello world")
self.assertTrue(type(qrcode) == str)
self.assertTrue(isinstance(qrcode, str))
self.assertTrue(qrcode.startswith('data:image/png;'))
self.assertEqual(len(qrcode), 700)
@ -192,7 +192,7 @@ class BarcodeTagTest(TestCase):
box_size=50,
format='BMP',
)
self.assertTrue(type(qrcode) == str)
self.assertTrue(isinstance(qrcode, str))
self.assertTrue(qrcode.startswith('data:image/bmp;'))
self.assertEqual(len(qrcode), 309720)