示例#1
0
 def runtest(self):
     try:
         parsed_ygp = ygp.loads(self._ygp)
     except ValueError:
         pass
     else:
         raise UnexpectedSuccessError(parsed_ygp)
示例#2
0
 def runtest(self):
     try:
         parsed_ygp = ygp.loads(self._ygp)
     except ValueError:
         pass
     else:
         raise UnexpectedSuccessError(parsed_ygp)
示例#3
0
    def runtest(self):
        try:
            parsed_ygp = ygp.loads(self._ygp)
            json_ygp = json.dumps(parsed_ygp, default=default)
            normalizd_ygp = json.loads(json_ygp)
        except ValueError as e:
            raise YGPParseError(self._ygp, e)

        try:
            parsed_json = json.loads(self._json)
        except ValueError as e:
            raise JSONParseError(self._json, e)

        if normalizd_ygp != parsed_json:
            raise IntergrationTestError(normalizd_ygp, parsed_json)
示例#4
0
    def runtest(self):
        try:
            parsed_ygp = ygp.loads(self._ygp)
            json_ygp = json.dumps(parsed_ygp, default=default)
            normalizd_ygp = json.loads(json_ygp)
        except ValueError as e:
            raise YGPParseError(self._ygp, e)

        try:
            parsed_json = json.loads(self._json)
        except ValueError as e:
            raise JSONParseError(self._json, e)

        if normalizd_ygp != parsed_json:
            raise IntergrationTestError(normalizd_ygp, parsed_json)
示例#5
0
import time
import yaml
import ygp

try:
    from yaml import CSafeLoader as SafeLoader
except:
    from yaml import SafeLoader

path = sys.argv[1]
ygp_time = 0
yaml_time = 0

for path in sys.argv[1:]:
    print 'checking', path

    src = open(path).read()

    start = time.time()
    yaml_version = yaml.load(src, Loader=SafeLoader)
    yaml_time += time.time() - start

    start = time.time()
    ygp_version = ygp.loads(src)
    ygp_time += time.time() - start

    assert ygp_version == yaml_version

print 'YGP:', ygp_time
print 'YAML:', yaml_time