git.schokokeks.org
Repositories
Help
Report an Issue
freewvs.git
Code
Commits
Branches
Tags
Suche
Strukturansicht:
0e178ac
Branches
Tags
master
v0.1.1
v0.1.2
v0.1.3
v0.1.4
freewvs.git
tests
test_jsonlint.py
add codingstyle and json linting tests
Hanno Böck
commited
0e178ac
at 2019-12-12 18:29:13
test_jsonlint.py
Blame
History
Raw
import unittest import glob import json import sys import difflib class TestJsonLint(unittest.TestCase): def test_json_lint(self): valid = True for f in glob.glob("freewvsdb/*.json"): fp = open(f, "r") orig = fp.read() fp.close() tmp = json.loads(orig) new = json.dumps(tmp, indent=2) if (orig != new): print("json %s not valid" % f) sys.stdout.writelines(difflib.unified_diff(orig, new)) valid = False if not valid: raise Exception("Unlinted json files found") if __name__ == '__main__': unittest.main()