def test_balance_sheet_serialize(): a = BalanceSheet( assets={ A_USD: Balance(amount=FVal('2'), usd_value=FVal('2')), A_ETH: Balance(amount=FVal('3'), usd_value=FVal('900')), }, liabilities={ A_DAI: Balance(amount=FVal('5'), usd_value=FVal('5.1')), A_ETH: Balance(amount=FVal('0.5'), usd_value=FVal('150')), }, ) assert a.serialize() == { 'assets': { 'USD': { 'amount': '2', 'usd_value': '2' }, 'ETH': { 'amount': '3', 'usd_value': '900' }, }, 'liabilities': { ethaddress_to_identifier('0x6B175474E89094C44Da98b954EedeAC495271d0F'): { 'amount': '5', 'usd_value': '5.1' }, # noqa: E501 'ETH': { 'amount': '0.5', 'usd_value': '150' }, }, }
def test_balance_sheet_serialize(): a = BalanceSheet( assets={ A_USD: Balance(amount=FVal('2'), usd_value=FVal('2')), A_ETH: Balance(amount=FVal('3'), usd_value=FVal('900')), }, liabilities={ A_DAI: Balance(amount=FVal('5'), usd_value=FVal('5.1')), A_ETH: Balance(amount=FVal('0.5'), usd_value=FVal('150')), }, ) assert a.serialize() == { 'assets': { 'USD': { 'amount': '2', 'usd_value': '2' }, 'ETH': { 'amount': '3', 'usd_value': '900' }, }, 'liabilities': { 'DAI': { 'amount': '5', 'usd_value': '5.1' }, 'ETH': { 'amount': '0.5', 'usd_value': '150' }, }, }