def test_json_pretty_dump(self):
   f = StringIO.StringIO()
   data = {'one':'two', 'a':'b'}
   util.json_pretty_dump(data, f)
   f.seek(0)
   check = f.read()
   assert '    "a"' in check
   assert '    "one"' in check
  if args.feedname:
    kw['feedname'] = args.feedname
  feed = entities.Feed(**kw)
  feed.bootstrap_gtfs(f)
  
  # Print basic feed information.
  print "Feed:", feed.onestop()
  print "  Stops:", len(feed.stops())
  print "  Routes:", len(feed.routes())
  print "  Operators:", len(feed.operators())
  # Print basic operator information.
  for operator in feed.operators():
    print "  Operator:", operator.name()
    print "    Routes:", len(operator.routes())
    print "    Stops:", len(operator.stops())

  # Write out updated feed.
  output = args.output or '%s.json'%feed.onestop()
  data = feed.json()
  if args.printjson:
    util.json_pretty_print(data)
  if os.path.exists(output):
    print "Error: Filename %s already exists."%output
    sys.exit(1)
  else:
    print "Writing to %s"%output
    with open(output, 'w') as f:
      util.json_pretty_dump(data, f)
    

    kw['debug'] = args.debug
    kw['url'] = args.url
    if args.feedname:
        kw['feedname'] = args.feedname
    feed = entities.Feed(**kw)
    feed.bootstrap_gtfs(f)

    # Print basic feed information.
    print "Feed:", feed.onestop()
    print "  Stops:", len(feed.stops())
    print "  Routes:", len(feed.routes())
    print "  Operators:", len(feed.operators())
    # Print basic operator information.
    for operator in feed.operators():
        print "  Operator:", operator.name()
        print "    Routes:", len(operator.routes())
        print "    Stops:", len(operator.stops())

    # Write out updated feed.
    output = args.output or '%s.json' % feed.onestop()
    data = feed.json()
    if args.printjson:
        util.json_pretty_print(data)
    if os.path.exists(output):
        print "Error: Filename %s already exists." % output
        sys.exit(1)
    else:
        print "Writing to %s" % output
        with open(output, 'w') as f:
            util.json_pretty_dump(data, f)