Giter Club home page Giter Club logo

ripple-python's Introduction

ripple-python


https://github.com/miracle2k/ripple-python/

// tests/test_datastructures.py
from decimal import Decimal
from pytest import raises
from ripple.datastructures import Amount

def test_amount():
  assert Amount(10).currency == 'XRP'
  assert Amount(10).issuer == None
  assert Amount(10).value == Decimal('0.00001')
  assert Amount(Decimal('10')).value == Decimal('10')
  assert Amount('10.0').value == Decimal('10')
  assert Amount('10').value == Decimal('0.00001')
  assert Amount('10.0').__json() == 100000000
  
  a = Amount(15)
  a.value = 10
  assert a.data == 100000000
  a = Amount({'value': '10', 'currency': 'USD'})
  a.value = 15
  assert a.data['value'] == '15'
  
  assert (Amount(10) + Amount(15)).value == Decimal('0.000025')
  assert (Amount({'value': '10', 'currency': 'USD'}) - '2').value == 8
  
  amount = Amount({'value': '10', 'currency': 'USD'})
  assert not ('issuer' in amount)
  amount['issuer'] = 'foo'
  assert amount.issuer == 'foo'
  
// tests/tx/account_root_node_without_fields.json
{
  "Paths": [
    [
      {
        "type": 1,
        "type_hex": "0000",
        "account": "xxx"
      },
    ]
  ]
}

ripple-python's People

Contributors

takagotch avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.