def test_function(self): f = function('ripple.util.test_function.fn(true, {1: 2}, none)') self.assertequals(f(), ((true, {1: 2}, none), {})) self.assertequals(f('hello', foo='bar'), (('hello', true, {1: 2}, none), {'foo':'bar'})) self.assertequals( f, function('ripple.util.test_function.fn(true, {1: 2}, null)'))
_parts = (args.command, args.ledgers) = ([], []) for c in _command: _parts[range.is_range(c, *ledgernumber.ledgers)].append(c) args.command = args.command or ['print' if args.ledgers else 'info'] args.cache = file.normalize(args.cache) if not args.ledgers: if args.condition: log.warn('--condition needs a range of ledgers') if args.display: log.warn('--display needs a range of ledgers') args.condition = function( args.condition or 'all_ledgers', 'ripple.ledger.conditions') args.display = function( args.display or 'ledger_number', 'ripple.ledger.displays') if args.window < 0: raise valueerror('window cannot be negative: --window=%d' % args.window) prettyprint.indent = (args.indent * ' ') _loaders = (args.database != none) + bool(args.rippled) + bool(args.server) if not _loaders: args.rippled = 'rippled' elif _loaders > 1:
def test_quoting(self): f = function('ripple.util.test_function.fn(testing)') self.assertequals(f(), (('testing',), {})) f = function('ripple.util.test_function.fn(testing, true, false, null)') self.assertequals(f(), (('testing', true, false, none), {}))
def test_empty_args(self): f = function('ripple.util.test_function.fn()') self.assertequals(f(), ((), {}))
def test_empty_function(self): self.assertequals(function()(), none)