8000 matplotlib/visual_tests.py at master · arunkgupta/matplotlib · GitHub
[go: up one dir, main page]

Skip to content
{"payload":{"allShortcutsEnabled":false,"fileTree":{"":{"items":[{"name":".github","path":".github","contentType":"directory"},{"name":"LICENSE","path":"LICENSE","contentType":"directory"},{"name":"ci","path":"ci","contentType":"directory"},{"name":"doc","path":"doc","contentType":"directory"},{"name":"examples","path":"examples","contentType":"directory"},{"name":"extern","path":"extern","contentType":"directory"},{"name":"lib","path":"lib","contentType":"directory"},{"name":"release","path":"release","contentType":"directory"},{"name":"src","path":"src","contentType":"directory"},{"name":"tools","path":"tools","contentType":"directory"},{"name":"unit","path":"unit","contentType":"directory"},{"name":".coveragerc","path":".coveragerc","contentType":"file"},{"name":".gitattributes","path":".gitattributes","contentType":"file"},{"name":".gitignore","path":".gitignore","contentType":"file"},{"name":".mailmap","path":".mailmap","contentType":"file"},{"name":".travis.yml","path":".travis.yml","contentType":"file"},{"name":"CHANGELOG","path":"CHANGELOG","contentType":"file"},{"name":"CONTRIBUTING.md","path":"CONTRIBUTING.md","contentType":"file"},{"name":"INSTALL","path":"INSTALL","contentType":"file"},{"name":"MANIFEST.in","path":"MANIFEST.in","contentType":"file"},{"name":"Makefile","path":"Makefile","contentType":"file"},{"name":"README.osx","path":"README.osx","contentType":"file"},{"name":"README.rst","path":"README.rst","contentType":"file"},{"name":"README.win.md","path":"README.win.md","contentType":"file"},{"name":"appveyor.yml","path":"appveyor.yml","contentType":"file"},{"name":"boilerplate.py","path":"boilerplate.py","contentType":"file"},{"name":"build_alllocal.cmd","path":"build_alllocal.cmd","contentType":"file"},{"name":"distribute_setup.py","path":"distribute_setup.py","contentType":"file"},{"name":"license.py","path":"license.py","contentType":"file"},{"name":"matplotlibrc.template","path":"matplotlibrc.template","contentType":"file"},{"name":"patched_bdist_wheel.py","path":"patched_bdist_wheel.py","contentType":"file"},{"name":"setup.cfg.template","path":"setup.cfg.template","contentType":"file"},{"name":"setup.py","path":"setup.py","contentType":"file"},{"name":"setup_external_compile.py","path":"setup_external_compile.py","contentType":"file"},{"name":"setupext.py","path":"setupext.py","contentType":"file"},{"name":"test.txt","path":"test.txt","contentType":"file"},{"name":"test_only.py","path":"test_only.py","contentType":"file"},{"name":"tests.py","path":"tests.py","contentType":"file"},{"name":"tox.ini","path":"tox.ini","contentType":"file"},{"name":"versioneer.py","path":"versioneer.py","contentType":"file"},{"name":"visual_tests.py","path":"visual_tests.py","contentType":"file"}],"totalCount":41}},"fileTreeProcessingTime":8.508046,"foldersToFetch":[],"incompleteFileTree":false,"repo":{"id":21455288,"defaultBranch":"master","name":"matplotlib","ownerLogin":"arunkgupta","currentUserCanPush":false,"isFork":true,"isEmpty":false,"createdAt":"2014-07-03T08:30:03.000Z","ownerAvatar":"https://avatars.githubusercontent.com/u/7445797?v=4","public":true,"private":false,"isOrgOwned":false},"codeLineWrapEnabled":false,"symbolsExpanded":false,"treeExpanded":true,"refInfo":{"name":"master","listCacheKey":"v0:1617222586.9932742","canEdit":false,"refType":"branch","currentOid":"e768c6f83a331ce3dc9a74128100899b3e41bc11"},"path":"visual_tests.py","currentUser":null,"blob":{"rawLines":["#!/usr/bin/env python","#","# This builds a html page of all images from the image comparison tests","# and opens that page in the browser.","#","# $ python visual_tests.py","#","","import os","import time","import six","","from collections import defaultdict","","def run():"," # Build a website for visual comparison"," image_dir = \"result_images\""," # build the website"," _html = \"\""," _html += \"\"\"\u003chtml\u003e\u003chead\u003e\u003cstyle media=\"screen\" type=\"text/css\"\u003e"," img{"," width:100%;"," max-width:800px;"," }"," \u003c/style\u003e"," \u003c/head\u003e\u003cbody\u003e\\n\"\"\""," _subdirs = [name for name in os.listdir(image_dir) if os.path.isdir(os.path.join(image_dir, name))]"," # loop over all pictures"," _row = '\u003ctr\u003e\u003ctd\u003e{0} {1}\u003c/td\u003e\u003ctd\u003e{2}\u003c/td\u003e\u003ctd\u003e\u003ca href=\"{3}\"\u003e\u003cimg src=\"{3}\"\u003e\u003c/a\u003e\u003c/td\u003e\u003ctd\u003e{4}\u003c/td\u003e\\n'"," _failed = \"\""," _failed += \"\u003ch2\u003eOnly Failed\u003c/h2\u003e\""," _failed += \"\u003ctable\u003e\\n\u003cthead\u003e\u003ctd\u003ename\u003c/td\u003e\u003ctd\u003eactual\u003c/td\u003e\u003ctd\u003eexpected\u003c/td\u003e\u003ctd\u003ediff\u003c/td\u003e\u003c/thead\u003e\\n\""," _has_failure = False"," _body = \"\""," for subdir in _subdirs:"," if subdir == \"test_compare_images\":"," # these are the image which test the image comparison functions..."," continue"," pictures = defaultdict(dict)"," for file in os.listdir(os.path.join(image_dir, subdir)):"," if os.path.isdir(os.path.join(image_dir, subdir, file)):"," continue"," fn, fext = os.path.splitext(file)"," if fext != \".png\":"," continue"," # Always use / for URLs."," if \"-failed-diff\" in fn:"," pictures[fn[:-12]][\"f\"] = \"/\".join((subdir, file))"," elif \"-expected\" in fn:"," pictures[fn[:-9]][\"e\"] = \"/\".join((subdir, file))"," else:"," pictures[fn][\"c\"] = \"/\".join((subdir, file))",""," _body += \"\u003ch2\u003e{0}\u003c/h2\u003e\".format(subdir)"," _body += \"\u003ctable\u003e\\n\u003cthead\u003e\u003ctd\u003ename\u003c/td\u003e\u003ctd\u003eactual\u003c/td\u003e\u003ctd\u003eexpected\u003c/td\u003e\u003ctd\u003ediff\u003c/td\u003e\u003c/thead\u003e\\n\""," for name, test in six.iteritems(pictures):"," if test.get(\"f\", None):"," # a real failure in the image generation, resulting in different images"," _has_failure = True"," s = \"(failed)\""," failed = '\u003ca href=\"{0}\"\u003ediff\u003c/a\u003e'.format(test.get(\"f\", \"\"))"," current = '\u003ca href=\"{0}\"\u003e\u003cimg src=\"{0}\"\u003e\u003c/a\u003e'.format(test.get(\"c\", \"\"))"," _failed += _row.format(name, \"\", current, test.get(\"e\", \"\"), failed)"," elif test.get(\"c\", None) is None:"," # A failure in the test, resulting in no current image"," _has_failure = True"," s = \"(failed)\""," failed = '--'"," current = '(Failure in test, no image produced)'"," _failed += _row.format(name, \"\", current, test.get(\"e\", \"\"), failed)"," else:"," s = \"(passed)\""," failed = '--'"," current = '\u003ca href=\"{0}\"\u003e\u003cimg src=\"{0}\"\u003e\u003c/a\u003e'.format(test.get(\"c\", \"\"))"," _body += _row.format(name, \"\", current, test.get(\"e\", \"\"), failed)"," _body += \"\u003c/table\u003e\\n\""," _failed += \"\u003c/table\u003e\\n\""," if _has_failure:"," _html += _failed"," _html += _body"," _html += \"\\n\u003c/body\u003e\u003c/html\u003e\""," index = os.path.join(image_dir, \"index.html\")"," with open(index, \"w\") as f:"," f.write(_html)"," try:"," import webbrowser"," webbrowser.open(index)"," except:"," print(\"Open {0} in a browser for a visual comparison.\".format(str(index)))","","if __name__ == '__main__':"," run()"],"stylingDirectives":null,"colorizedLines":null,"csv":null,"csvError":null,"dependabotInfo":{"showConfigurationBanner":false,"configFilePath":null,"networkDependabotPath":"/arunkgupta/matplotlib/network/updates","dismissConfigurationNoticePath":"/settings/dismiss-notice/dependabot_configuration_notice","configurationNoticeDismissed":null},"displayName":"visual_tests.py","displayUrl":"https://github.com/arunkgupta/matplotlib/blob/master/visual_tests.py?raw=true","headerInfo":{"blobSize":"3.38 KB","deleteTooltip":"You must be signed in to make or propose changes","editTooltip":"You must be signed in to make or propose changes","ghDesktopPath":"https://desktop.github.com","isGitLfs":false,"onBranch":true,"shortPath":"f395b9d","siteNavLoginPath":"/login?return_to=https%3A%2F%2Fgithub.com%2Farunkgupta%2Fmatplotlib%2Fblob%2Fmaster%2Fvisual_tests.py","isCSV":false,"isRichtext":false,"toc":null,"lineInfo":{"truncatedLoc":"92","truncatedSloc":"87"},"mode":"file"},"image":false,"isCodeownersFile":null,"isPlain":false,"isValidLegacyIssueTemplate":false,"issueTemplate":null,"discussionTemplate":null,"language":"Python","languageID":303,"large":false,"planSupportInfo":{"repoIsFork":null,"repoOwnedByCurrentUser":null,"requestFullPath":"/arunkgupta/matplotlib/blob/master/visual_tests.py","showFreeOrgGatedFeatureMessage":null,"showPlanSupportBanner":null,"upgradeDataAttributes":null,"upgradePath":null},"publishBannersInfo":{"dismissActionNoticePath":"/settings/dismiss-notice/publish_action_from_dockerfile","releasePath":"/arunkgupta/matplotlib/releases/new?marketplace=true","showPublishActionBanner":false},"rawBlobUrl":"https://github.com/arunkgupta/matplotlib/raw/refs/heads/master/visual_tests.py","renderImageOrRaw":false,"richText":null,"renderedFileInfo":null,"shortPath":null,"symbolsEnabled":true,"tabSize":8,"topBannersInfo":{"overridingGlobalFundingFile":false,"globalPreferredFundingPath":null,"showInvalidCitationWarning":false,"citationHelpUrl":"https://docs.github.com/github/creating-cloning-and-archiving-repositories/creating-a-repository-on-github/about-citation-files","actionsOnboardingTip":null},"truncated":false,"viewable":true,"workflowRedirectUrl":null,"symbols":{"timed_out":false,"not_analyzed":false,"symbols":[{"name":"run","kind":"function","ident_start":243,"ident_end":246,"extent_start":239,"extent_end":3425,"fully_qualified_name":"run","ident_utf16":{"start":{"line_number":14,"utf16_col":4},"end":{"line_number":14,"utf16_col":7}},"extent_utf16":{"start":{"line_number":14,"utf16_col":0},"end":{"line_number":88,"utf16_col":82}}}]}},"copilotInfo":null,"copilotAccessAllowed":false,"modelsAccessAllowed":false,"modelsRepoIntegrationEnabled":false,"csrf_tokens":{"/arunkgupta/matplotlib/branches":{"post":"2G3-3dMSuZo43O1kIR0uRePz38c8eL8ZBHNH5RfTlqkSdPorrZstDGgKeLxH1VeadG71IOEndmZd9m5BijcfNg"},"/repos/preferences":{"post":"zJqVJfOXEpRKef4jQkm4sIY6JWbWT8n7mxluDwPFAFCi1xGVGEobeQv6m9NC_xkUkaQm33vNDiRf_C7Eq73uxw"}}},"title":"matplotlib/visual_tests.py at master · arunkgupta/matplotlib","appPayload":{"helpUrl":"https://docs.github.com","findFileWorkerPath":"/assets-cdn/worker/find-file-worker-7d7eb7c71814.js","findInFileWorkerPath":"/assets-cdn/worker/find-in-file-worker-1ae9fa256942.js","githubDevUrl":null,"enabled_features":{"code_nav_ui_events":false,"react_blob_overlay":false,"accessible_code_button":true,"github_models_repo_integration":false}}}
0