There was an error while loading. Please reload this page.
1 parent 248104f commit 91cc6d4Copy full SHA for 91cc6d4
tests/unit/test_decimal.py
@@ -0,0 +1,21 @@
1
+from decimal import Decimal
2
+import unittest
3
+from quickbooks.objects.bill import Bill
4
+from quickbooks.objects.detailline import DetailLine
5
+
6
7
+class DecimalTestCase(unittest.TestCase):
8
+ def test_bill_with_decimal_amount(self):
9
+ """Test that a Bill with decimal line amounts can be converted to JSON without errors"""
10
+ bill = Bill()
11
+ line = DetailLine()
12
+ line.Amount = Decimal('42.42')
13
+ line.DetailType = "AccountBasedExpenseLineDetail"
14
15
+ bill.Line.append(line)
16
17
+ # This should not raise any exceptions
18
+ json_data = bill.to_json()
19
20
+ # Verify the amount was converted correctly
21
+ self.assertIn('"Amount": "42.42"', json_data)
0 commit comments