コード例 #1
0
ファイル: test_xom.py プロジェクト: ZhiyuanZou/LAB1
__author__ = 'zou'

import json
import yahoo_options_data

computedJson = yahoo_options_data.contractAsJson("xom.dat")
expectedJson = open("xom.json").read()
expectedJson_changed = open("xom_change.json").read()

if json.loads(computedJson) != json.loads(expectedJson) and json.loads(computedJson) != json.loads(expectedJson_changed):
  print "Test failed!"
  print "Expected output:", expectedJson
  print "Your output:", computedJson
  assert False
else:
  print "Test passed"
コード例 #2
0
import json
import yahoo_options_data

computedJson = yahoo_options_data.contractAsJson("f.dat")
expectedJson = open("f.json").read()
expectedJson_change = open("f_change.json").read()

if json.loads(computedJson) != json.loads(expectedJson) and json.loads(
        computedJson) != json.loads(expectedJson_change):
    print "Test failed!"
    print "Expected output:", expectedJson
    print "Your output:", computedJson
    assert False
else:
    print "Test passed"