import json import os import sys def fenced(before, after, s): if before not in s or after not in s: return '' start = s.find(before) + len(before) end = s.find(after, start) return s[start:end] def get_css(html): start = '' return start + fenced(start, end, html) + end def get_value(word, s): start = s.find(word) if start == -1: return None return fenced('"is",', ']', s[start + len(word):]).strip().strip('"') def extract_tests(path): tests = [] for root, _dirs, files in sorted(os.walk(path)): for filename in files: if not filename.endswith('.html'): continue if filename.endswith('.tentative.html'): continue with open(os.path.join(root, filename)) as fh: raw = fh.read() if '