mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Unit test fixes
This commit is contained in:
parent
ac512cb8bb
commit
6fcc9ec8f0
@ -272,7 +272,7 @@ class StockItem(MPTTModel):
|
||||
|
||||
serial = str(serial).strip()
|
||||
|
||||
serial_int = extract_int(str(serial))
|
||||
serial_int = extract_int(serial)
|
||||
|
||||
self.serial_int = serial_int
|
||||
|
||||
|
@ -405,15 +405,15 @@ class StockTest(TestCase):
|
||||
item.serial = "-123"
|
||||
item.save()
|
||||
|
||||
# Negative number should map to zero
|
||||
self.assertEqual(item.serial_int, 0)
|
||||
|
||||
# Test a very very large value
|
||||
item.serial = '99999999999999999999999999999999999999999999999999999'
|
||||
item.save()
|
||||
|
||||
self.assertEqual(item.serial_int, 0x7fffffff)
|
||||
|
||||
# Negative number should map to zero
|
||||
self.assertEqual(item.serial_int, 0)
|
||||
|
||||
# Non-numeric values should encode to zero
|
||||
for sn in ['apple', 'banana', 'carrot']:
|
||||
item.serial = sn
|
||||
|
Loading…
Reference in New Issue
Block a user