Fix a flaky test by using a local web server

This commit is contained in:
Brian Quinlan
2022-03-15 15:25:47 -07:00
parent a12ea41aa6
commit 5973dbf35d
20 changed files with 94 additions and 26 deletions

View File

@@ -21,17 +21,25 @@ import os.path
import pkg_resources
import pybadges
from tests import image_server
from tests import test_pybadges
def generate_images(source_json_path, target_directory):
os.makedirs(target_directory, exist_ok=True)
with open(source_json_path) as f:
examples = json.load(f)
srv = image_server.ImageServer(test_pybadges.PNG_IMAGE)
srv.start_server()
try:
os.makedirs(target_directory, exist_ok=True)
with open(source_json_path) as f:
examples = json.load(f)
for example in examples:
filename = os.path.join(target_directory, example.pop('file_name'))
with open(filename, 'w') as f:
f.write(pybadges.badge(**example))
for example in examples:
srv.fix_embedded_url_reference(example)
filename = os.path.join(target_directory, example.pop('file_name'))
with open(filename, 'w', encoding='utf-8') as f:
f.write(pybadges.badge(**example))
finally:
srv.stop_server()
def main():

0
tests/__init__.py Normal file
View File

View File

@@ -1 +1 @@
<svg height="20" width="110.9" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><linearGradient id="smooth" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="round"><rect fill="#fff" height="20" rx="3" width="110.9"/></clipPath><g clip-path="url(#round)"><rect fill="#555" height="20" width="76.4"/><rect fill="#dfb317" height="20" width="34.5" x="76.4"/><rect fill="url(#smooth)" height="20" width="110.9"/></g><g fill="#fff" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="110" text-anchor="middle"><image height="14" width="14" x="5" xlink:href="data:image/svg+xml;utf8,&lt;svg xmlns=&quot;http://www.w3.org/2000/svg&quot; xmlns:xlink=&quot;http://www.w3.org/1999/xlink&quot; height=&quot;120&quot; width=&quot;120&quot;&gt;&lt;circle cx=&quot;60&quot; cy=&quot;60&quot; r=&quot;60&quot; fill=&quot;#c00&quot; /&gt;&lt;circle cx=&quot;60&quot; cy=&quot;60&quot; r=&quot;50&quot; fill=&quot;#ddd&quot; /&gt;&lt;circle cx=&quot;60&quot; cy=&quot;60&quot; r=&quot;40&quot; fill=&quot;#c00&quot; /&gt;&lt;circle cx=&quot;60&quot; cy=&quot;60&quot; r=&quot;30&quot; fill=&quot;#ddd&quot; /&gt;&lt;circle cx=&quot;60&quot; cy=&quot;60&quot; r=&quot;20&quot; fill=&quot;#c00&quot; /&gt;&lt;/svg&gt;" y="3"/><text fill="#010101" fill-opacity=".3" lengthAdjust="spacing" textLength="494.00000000000006" transform="scale(0.1)" x="477.0" y="150">accuracy</text><text lengthAdjust="spacing" textLength="494.00000000000006" transform="scale(0.1)" x="477.0" y="140">accuracy</text><text fill="#010101" fill-opacity=".3" lengthAdjust="spacing" textLength="245.0" transform="scale(0.1)" x="926.5" y="150">70%</text><text lengthAdjust="spacing" textLength="245.0" transform="scale(0.1)" x="926.5" y="140">70%</text></g></svg>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="110.9" height="20"><linearGradient id="smooth" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="round"><rect width="110.9" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#round)"><rect width="76.4" height="20" fill="#555"/><rect x="76.4" width="34.5" height="20" fill="#dfb317"/><rect width="110.9" height="20" fill="url(#smooth)"/></g><g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="110"><image x="5" y="3" width="14" height="14" xlink:href="data:image/svg+xml;utf8,&lt;svg xmlns=&quot;http://www.w3.org/2000/svg&quot; xmlns:xlink=&quot;http://www.w3.org/1999/xlink&quot; height=&quot;120&quot; width=&quot;120&quot;&gt;&lt;circle cx=&quot;60&quot; cy=&quot;60&quot; r=&quot;60&quot; fill=&quot;#c00&quot; /&gt;&lt;circle cx=&quot;60&quot; cy=&quot;60&quot; r=&quot;50&quot; fill=&quot;#ddd&quot; /&gt;&lt;circle cx=&quot;60&quot; cy=&quot;60&quot; r=&quot;40&quot; fill=&quot;#c00&quot; /&gt;&lt;circle cx=&quot;60&quot; cy=&quot;60&quot; r=&quot;30&quot; fill=&quot;#ddd&quot; /&gt;&lt;circle cx=&quot;60&quot; cy=&quot;60&quot; r=&quot;20&quot; fill=&quot;#c00&quot; /&gt;&lt;/svg&gt;"/><text x="477.0" y="150" fill="#010101" fill-opacity=".3" transform="scale(0.1)" textLength="494.00000000000006" lengthAdjust="spacing">accuracy</text><text x="477.0" y="140" transform="scale(0.1)" textLength="494.00000000000006" lengthAdjust="spacing">accuracy</text><text x="926.5" y="150" fill="#010101" fill-opacity=".3" transform="scale(0.1)" textLength="245.0" lengthAdjust="spacing">70%</text><text x="926.5" y="140" transform="scale(0.1)" textLength="245.0" lengthAdjust="spacing">70%</text></g></svg>

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@@ -1 +1 @@
<svg height="20" width="82.30000000000001" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><title>Error in foo.py, line 3</title><linearGradient id="smooth" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="round"><rect fill="#fff" height="20" rx="3" width="82.30000000000001"/></clipPath><g clip-path="url(#round)"><rect fill="#555" height="20" width="37.2"/><rect fill="#c00" height="20" width="45.1" x="37.2"/><rect fill="url(#smooth)" height="20" width="82.30000000000001"/></g><g fill="#fff" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="110" text-anchor="middle"><text fill="#010101" fill-opacity=".3" lengthAdjust="spacing" textLength="272.0" transform="scale(0.1)" x="196.0" y="150">build</text><text lengthAdjust="spacing" textLength="272.0" transform="scale(0.1)" x="196.0" y="140">build</text><text fill="#010101" fill-opacity=".3" lengthAdjust="spacing" textLength="351.0" transform="scale(0.1)" x="587.5" y="150">failure</text><text lengthAdjust="spacing" textLength="351.0" transform="scale(0.1)" x="587.5" y="140">failure</text></g></svg>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="82.30000000000001" height="20"><title>Error in foo.py, line 3</title><linearGradient id="smooth" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="round"><rect width="82.30000000000001" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#round)"><rect width="37.2" height="20" fill="#555"/><rect x="37.2" width="45.1" height="20" fill="#c00"/><rect width="82.30000000000001" height="20" fill="url(#smooth)"/></g><g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="110"><text x="196.0" y="150" fill="#010101" fill-opacity=".3" transform="scale(0.1)" textLength="272.0" lengthAdjust="spacing">build</text><text x="196.0" y="140" transform="scale(0.1)" textLength="272.0" lengthAdjust="spacing">build</text><text x="587.5" y="150" fill="#010101" fill-opacity=".3" transform="scale(0.1)" textLength="351.0" lengthAdjust="spacing">failure</text><text x="587.5" y="140" transform="scale(0.1)" textLength="351.0" lengthAdjust="spacing">failure</text></g></svg>

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@@ -1 +1 @@
<svg height="20" width="89.4" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><linearGradient id="smooth" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="round"><rect fill="#fff" height="20" rx="3" width="89.4"/></clipPath><g clip-path="url(#round)"><rect fill="#555" height="20" width="37.2"/><rect fill="#97CA00" height="20" width="52.2" x="37.2"/><rect fill="url(#smooth)" height="20" width="89.4"/></g><g fill="#fff" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="110" text-anchor="middle"><text fill="#010101" fill-opacity=".3" lengthAdjust="spacing" textLength="272.0" transform="scale(0.1)" x="196.0" y="150">build</text><text lengthAdjust="spacing" textLength="272.0" transform="scale(0.1)" x="196.0" y="140">build</text><text fill="#010101" fill-opacity=".3" lengthAdjust="spacing" textLength="422.0" transform="scale(0.1)" x="623.0" y="150">passing</text><text lengthAdjust="spacing" textLength="422.0" transform="scale(0.1)" x="623.0" y="140">passing</text></g></svg>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="89.4" height="20"><linearGradient id="smooth" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="round"><rect width="89.4" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#round)"><rect width="37.2" height="20" fill="#555"/><rect x="37.2" width="52.2" height="20" fill="#97CA00"/><rect width="89.4" height="20" fill="url(#smooth)"/></g><g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="110"><text x="196.0" y="150" fill="#010101" fill-opacity=".3" transform="scale(0.1)" textLength="272.0" lengthAdjust="spacing">build</text><text x="196.0" y="140" transform="scale(0.1)" textLength="272.0" lengthAdjust="spacing">build</text><text x="623.0" y="150" fill="#010101" fill-opacity=".3" transform="scale(0.1)" textLength="422.0" lengthAdjust="spacing">passing</text><text x="623.0" y="140" transform="scale(0.1)" textLength="422.0" lengthAdjust="spacing">passing</text></g></svg>

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -1 +1 @@
<svg height="20" width="89.80000000000001" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><linearGradient id="smooth" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="round"><rect fill="#fff" height="20" rx="3" width="89.80000000000001"/></clipPath><g clip-path="url(#round)"><rect fill="#555" height="20" width="37.2"/><rect fill="#007ec6" height="20" width="52.6" x="37.2"/><rect fill="url(#smooth)" height="20" width="89.80000000000001"/></g><g fill="#fff" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="110" text-anchor="middle"><text fill="#010101" fill-opacity=".3" lengthAdjust="spacing" textLength="272.0" transform="scale(0.1)" x="196.0" y="150">build</text><text lengthAdjust="spacing" textLength="272.0" transform="scale(0.1)" x="196.0" y="140">build</text><text fill="#010101" fill-opacity=".3" lengthAdjust="spacing" textLength="426.0" transform="scale(0.1)" x="625.0" y="150">running</text><text lengthAdjust="spacing" textLength="426.0" transform="scale(0.1)" x="625.0" y="140">running</text></g></svg>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="89.80000000000001" height="20"><linearGradient id="smooth" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="round"><rect width="89.80000000000001" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#round)"><rect width="37.2" height="20" fill="#555"/><rect x="37.2" width="52.6" height="20" fill="#007ec6"/><rect width="89.80000000000001" height="20" fill="url(#smooth)"/></g><g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="110"><text x="196.0" y="150" fill="#010101" fill-opacity=".3" transform="scale(0.1)" textLength="272.0" lengthAdjust="spacing">build</text><text x="196.0" y="140" transform="scale(0.1)" textLength="272.0" lengthAdjust="spacing">build</text><text x="625.0" y="150" fill="#010101" fill-opacity=".3" transform="scale(0.1)" textLength="426.0" lengthAdjust="spacing">running</text><text x="625.0" y="140" transform="scale(0.1)" textLength="426.0" lengthAdjust="spacing">running</text></g></svg>

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -1 +1 @@
<svg height="20" width="136.0" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><title>Badge Title</title><linearGradient id="smooth" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="round"><rect fill="#fff" height="20" rx="3" width="136.0"/></clipPath><g clip-path="url(#round)"><rect fill="#97CA00" height="20" width="78.4"><title>Left Title</title></rect><rect fill="#fb3" height="20" width="57.6" x="78.4"><title>Right Title</title></rect><rect fill="url(#smooth)" height="20" width="136.0"/></g><g fill="#fff" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="110" text-anchor="middle"><image height="14" width="14" x="5" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAIAAAACCAIAAAD91JpzAAAAD0lEQVQI12P4zwAD/xkYAA/+Af8iHnLUAAAAAElFTkSuQmCC" y="3"/><text fill="#010101" fill-opacity=".3" lengthAdjust="spacing" textLength="514.0" transform="scale(0.1)" x="487.0" y="150">complete</text><text lengthAdjust="spacing" textLength="514.0" transform="scale(0.1)" x="487.0" y="140">complete</text><text fill="#010101" fill-opacity=".3" lengthAdjust="spacing" textLength="476.0" transform="scale(0.1)" x="1062.0" y="150">example</text><text lengthAdjust="spacing" textLength="476.0" transform="scale(0.1)" x="1062.0" y="140">example</text><a xlink:href="http://www.complete.com/"><rect fill="rgba(0,0,0,0)" height="20" width="78.4"/></a><a xlink:href="http://www.example.com"><rect fill="rgba(0,0,0,0)" height="20" width="57.6" x="78.4"/></a></g></svg>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="136.0" height="20"><title>Badge Title</title><linearGradient id="smooth" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="round"><rect width="136.0" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#round)"><rect width="78.4" height="20" fill="#97CA00"><title>Left Title</title></rect><rect x="78.4" width="57.6" height="20" fill="#fb3"><title>Right Title</title></rect><rect width="136.0" height="20" fill="url(#smooth)"/></g><g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="110"><image x="5" y="3" width="14" height="14" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAIAAAACCAIAAAD91JpzAAAAD0lEQVQI12P4zwAD/xkYAA/+Af8iHnLUAAAAAElFTkSuQmCC"/><text x="487.0" y="150" fill="#010101" fill-opacity=".3" transform="scale(0.1)" textLength="514.0" lengthAdjust="spacing">complete</text><text x="487.0" y="140" transform="scale(0.1)" textLength="514.0" lengthAdjust="spacing">complete</text><text x="1062.0" y="150" fill="#010101" fill-opacity=".3" transform="scale(0.1)" textLength="476.0" lengthAdjust="spacing">example</text><text x="1062.0" y="140" transform="scale(0.1)" textLength="476.0" lengthAdjust="spacing">example</text><a xlink:href="http://www.complete.com/"><rect width="78.4" height="20" fill="rgba(0,0,0,0)"/></a><a xlink:href="http://www.example.com"><rect x="78.4" width="57.6" height="20" fill="rgba(0,0,0,0)"/></a></g></svg>

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@@ -1 +1 @@
<svg height="20" width="129.8" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><linearGradient id="smooth" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="round"><rect fill="#fff" height="20" rx="3" width="129.8"/></clipPath><g clip-path="url(#round)"><rect fill="#555" height="20" width="100.8"/><rect fill="#007ec6" height="20" width="29.0" x="100.8"/><rect fill="url(#smooth)" height="20" width="129.8"/></g><g fill="#fff" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="110" text-anchor="middle"><image height="14" width="14" x="5" xlink:href="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAgMTAwIj4KICA8ZGVmcz4KICAgIDxsaW5lYXJHcmFkaWVudCBpZD0icHlZZWxsb3ciIGdyYWRpZW50VHJhbnNmb3JtPSJyb3RhdGUoNDUpIj4KICAgICAgPHN0b3Agc3RvcC1jb2xvcj0iI2ZlNSIgb2Zmc2V0PSIwLjYiLz4KICAgICAgPHN0b3Agc3RvcC1jb2xvcj0iI2RhMSIgb2Zmc2V0PSIxIi8+CiAgICA8L2xpbmVhckdyYWRpZW50PgogICAgPGxpbmVhckdyYWRpZW50IGlkPSJweUJsdWUiIGdyYWRpZW50VHJhbnNmb3JtPSJyb3RhdGUoNDUpIj4KICAgICAgPHN0b3Agc3RvcC1jb2xvcj0iIzY5ZiIgb2Zmc2V0PSIwLjQiLz4KICAgICAgPHN0b3Agc3RvcC1jb2xvcj0iIzQ2OCIgb2Zmc2V0PSIxIi8+CiAgICA8L2xpbmVhckdyYWRpZW50PgogIDwvZGVmcz4KCiAgPHBhdGggZD0iTTI3LDE2YzAtNyw5LTEzLDI0LTEzYzE1LDAsMjMsNiwyMywxM2wwLDIyYzAsNy01LDEyLTExLDEybC0yNCwwYy04LDAtMTQsNi0xNCwxNWwwLDEwbC05LDBjLTgsMC0xMy05LTEzLTI0YzAtMTQsNS0yMywxMy0yM2wzNSwwbDAtM2wtMjQsMGwwLTlsMCwweiBNODgsNTB2MSIgZmlsbD0idXJsKCNweUJsdWUpIi8+CiAgPHBhdGggZD0iTTc0LDg3YzAsNy04LDEzLTIzLDEzYy0xNSwwLTI0LTYtMjQtMTNsMC0yMmMwLTcsNi0xMiwxMi0xMmwyNCwwYzgsMCwxNC03LDE0LTE1bDAtMTBsOSwwYzcsMCwxMyw5LDEzLDIzYzAsMTUtNiwyNC0xMywyNGwtMzUsMGwwLDNsMjMsMGwwLDlsMCwweiBNMTQwLDUwdjEiIGZpbGw9InVybCgjcHlZZWxsb3cpIi8+CgogIDxjaXJjbGUgcj0iNCIgY3g9IjY0IiBjeT0iODgiIGZpbGw9IiNGRkYiLz4KICA8Y2lyY2xlIHI9IjQiIGN4PSIzNyIgY3k9IjE1IiBmaWxsPSIjRkZGIi8+Cjwvc3ZnPgo=" y="3"/><text fill="#010101" fill-opacity=".3" lengthAdjust="spacing" textLength="738.0" transform="scale(0.1)" x="599.0" y="150">--embed-logo</text><text lengthAdjust="spacing" textLength="738.0" transform="scale(0.1)" x="599.0" y="140">--embed-logo</text><text fill="#010101" fill-opacity=".3" lengthAdjust="spacing" textLength="190.0" transform="scale(0.1)" x="1143.0" y="150">yes</text><text lengthAdjust="spacing" textLength="190.0" transform="scale(0.1)" x="1143.0" y="140">yes</text></g></svg>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="129.8" height="20"><linearGradient id="smooth" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="round"><rect width="129.8" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#round)"><rect width="100.8" height="20" fill="#555"/><rect x="100.8" width="29.0" height="20" fill="#007ec6"/><rect width="129.8" height="20" fill="url(#smooth)"/></g><g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="110"><image x="5" y="3" width="14" height="14" xlink:href="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAgMTAwIj4KICA8ZGVmcz4KICAgIDxsaW5lYXJHcmFkaWVudCBpZD0icHlZZWxsb3ciIGdyYWRpZW50VHJhbnNmb3JtPSJyb3RhdGUoNDUpIj4KICAgICAgPHN0b3Agc3RvcC1jb2xvcj0iI2ZlNSIgb2Zmc2V0PSIwLjYiLz4KICAgICAgPHN0b3Agc3RvcC1jb2xvcj0iI2RhMSIgb2Zmc2V0PSIxIi8+CiAgICA8L2xpbmVhckdyYWRpZW50PgogICAgPGxpbmVhckdyYWRpZW50IGlkPSJweUJsdWUiIGdyYWRpZW50VHJhbnNmb3JtPSJyb3RhdGUoNDUpIj4KICAgICAgPHN0b3Agc3RvcC1jb2xvcj0iIzY5ZiIgb2Zmc2V0PSIwLjQiLz4KICAgICAgPHN0b3Agc3RvcC1jb2xvcj0iIzQ2OCIgb2Zmc2V0PSIxIi8+CiAgICA8L2xpbmVhckdyYWRpZW50PgogIDwvZGVmcz4KCiAgPHBhdGggZD0iTTI3LDE2YzAtNyw5LTEzLDI0LTEzYzE1LDAsMjMsNiwyMywxM2wwLDIyYzAsNy01LDEyLTExLDEybC0yNCwwYy04LDAtMTQsNi0xNCwxNWwwLDEwbC05LDBjLTgsMC0xMy05LTEzLTI0YzAtMTQsNS0yMywxMy0yM2wzNSwwbDAtM2wtMjQsMGwwLTlsMCwweiBNODgsNTB2MSIgZmlsbD0idXJsKCNweUJsdWUpIi8+CiAgPHBhdGggZD0iTTc0LDg3YzAsNy04LDEzLTIzLDEzYy0xNSwwLTI0LTYtMjQtMTNsMC0yMmMwLTcsNi0xMiwxMi0xMmwyNCwwYzgsMCwxNC03LDE0LTE1bDAtMTBsOSwwYzcsMCwxMyw5LDEzLDIzYzAsMTUtNiwyNC0xMywyNGwtMzUsMGwwLDNsMjMsMGwwLDlsMCwweiBNMTQwLDUwdjEiIGZpbGw9InVybCgjcHlZZWxsb3cpIi8+CgogIDxjaXJjbGUgcj0iNCIgY3g9IjY0IiBjeT0iODgiIGZpbGw9IiNGRkYiLz4KICA8Y2lyY2xlIHI9IjQiIGN4PSIzNyIgY3k9IjE1IiBmaWxsPSIjRkZGIi8+Cjwvc3ZnPgo="/><text x="599.0" y="150" fill="#010101" fill-opacity=".3" transform="scale(0.1)" textLength="738.0" lengthAdjust="spacing">--embed-logo</text><text x="599.0" y="140" transform="scale(0.1)" textLength="738.0" lengthAdjust="spacing">--embed-logo</text><text x="1143.0" y="150" fill="#010101" fill-opacity=".3" transform="scale(0.1)" textLength="190.0" lengthAdjust="spacing">yes</text><text x="1143.0" y="140" transform="scale(0.1)" textLength="190.0" lengthAdjust="spacing">yes</text></g></svg>

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

@@ -1 +1 @@
<svg height="20" width="109.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><linearGradient id="smooth" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="round"><rect fill="#fff" height="20" rx="3" width="109.1"/></clipPath><g clip-path="url(#round)"><rect fill="#555" height="20" width="45.4"/><rect fill="#007ec6" height="20" width="63.7" x="45.4"/><rect fill="url(#smooth)" height="20" width="109.1"/></g><g fill="#fff" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="110" text-anchor="middle"><text fill="#010101" fill-opacity=".3" lengthAdjust="spacing" textLength="354.0" transform="scale(0.1)" x="237.0" y="150">github</text><text lengthAdjust="spacing" textLength="354.0" transform="scale(0.1)" x="237.0" y="140">github</text><text fill="#010101" fill-opacity=".3" lengthAdjust="spacing" textLength="537.0" transform="scale(0.1)" x="762.5" y="150">pybadges</text><text lengthAdjust="spacing" textLength="537.0" transform="scale(0.1)" x="762.5" y="140">pybadges</text><a xlink:href=""><rect fill="rgba(0,0,0,0)" height="20" width="45.4"/></a><a xlink:href="TODO"><rect fill="rgba(0,0,0,0)" height="20" width="63.7" x="45.4"/></a></g></svg>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="109.1" height="20"><linearGradient id="smooth" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="round"><rect width="109.1" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#round)"><rect width="45.4" height="20" fill="#555"/><rect x="45.4" width="63.7" height="20" fill="#007ec6"/><rect width="109.1" height="20" fill="url(#smooth)"/></g><g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="110"><text x="237.0" y="150" fill="#010101" fill-opacity=".3" transform="scale(0.1)" textLength="354.0" lengthAdjust="spacing">github</text><text x="237.0" y="140" transform="scale(0.1)" textLength="354.0" lengthAdjust="spacing">github</text><text x="762.5" y="150" fill="#010101" fill-opacity=".3" transform="scale(0.1)" textLength="537.0" lengthAdjust="spacing">pybadges</text><text x="762.5" y="140" transform="scale(0.1)" textLength="537.0" lengthAdjust="spacing">pybadges</text><a xlink:href=""><rect width="45.4" height="20" fill="rgba(0,0,0,0)"/></a><a xlink:href="TODO"><rect x="45.4" width="63.7" height="20" fill="rgba(0,0,0,0)"/></a></g></svg>

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@@ -1 +1 @@
<svg height="20" width="124.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><linearGradient id="smooth" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="round"><rect fill="#fff" height="20" rx="3" width="124.1"/></clipPath><g clip-path="url(#round)"><rect fill="#555" height="20" width="48.5"/><rect fill="#007ec6" height="20" width="75.6" x="48.5"/><rect fill="url(#smooth)" height="20" width="124.1"/></g><g fill="#fff" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="110" text-anchor="middle"><text fill="#010101" fill-opacity=".3" lengthAdjust="spacing" textLength="385.0" transform="scale(0.1)" x="252.5" y="150">license</text><text lengthAdjust="spacing" textLength="385.0" transform="scale(0.1)" x="252.5" y="140">license</text><text fill="#010101" fill-opacity=".3" lengthAdjust="spacing" textLength="656.0" transform="scale(0.1)" x="853.0" y="150">APACHE 2.0</text><text lengthAdjust="spacing" textLength="656.0" transform="scale(0.1)" x="853.0" y="140">APACHE 2.0</text><a xlink:href="https://opensource.org/licenses"><rect fill="rgba(0,0,0,0)" height="20" width="48.5"/></a><a xlink:href="https://opensource.org/licenses/Apache-2.0"><rect fill="rgba(0,0,0,0)" height="20" width="75.6" x="48.5"/></a></g></svg>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="124.1" height="20"><linearGradient id="smooth" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="round"><rect width="124.1" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#round)"><rect width="48.5" height="20" fill="#555"/><rect x="48.5" width="75.6" height="20" fill="#007ec6"/><rect width="124.1" height="20" fill="url(#smooth)"/></g><g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="110"><text x="252.5" y="150" fill="#010101" fill-opacity=".3" transform="scale(0.1)" textLength="385.0" lengthAdjust="spacing">license</text><text x="252.5" y="140" transform="scale(0.1)" textLength="385.0" lengthAdjust="spacing">license</text><text x="853.0" y="150" fill="#010101" fill-opacity=".3" transform="scale(0.1)" textLength="656.0" lengthAdjust="spacing">APACHE 2.0</text><text x="853.0" y="140" transform="scale(0.1)" textLength="656.0" lengthAdjust="spacing">APACHE 2.0</text><a xlink:href="https://opensource.org/licenses"><rect width="48.5" height="20" fill="rgba(0,0,0,0)"/></a><a xlink:href="https://opensource.org/licenses/Apache-2.0"><rect x="48.5" width="75.6" height="20" fill="rgba(0,0,0,0)"/></a></g></svg>

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@@ -1 +1 @@
<svg height="20" width="124.5" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><linearGradient id="smooth" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="round"><rect fill="#fff" height="20" rx="3" width="124.5"/></clipPath><g clip-path="url(#round)"><rect fill="#555" height="20" width="100.8"/><rect fill="#007ec6" height="20" width="23.7" x="100.8"/><rect fill="url(#smooth)" height="20" width="124.5"/></g><g fill="#fff" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="110" text-anchor="middle"><image height="14" width="14" x="5" xlink:href="https://dev.w3.org/SVG/tools/svgweb/samples/svg-files/python.svg" y="3"/><text fill="#010101" fill-opacity=".3" lengthAdjust="spacing" textLength="738.0" transform="scale(0.1)" x="599.0" y="150">--embed-logo</text><text lengthAdjust="spacing" textLength="738.0" transform="scale(0.1)" x="599.0" y="140">--embed-logo</text><text fill="#010101" fill-opacity=".3" lengthAdjust="spacing" textLength="137.0" transform="scale(0.1)" x="1116.5" y="150">no</text><text lengthAdjust="spacing" textLength="137.0" transform="scale(0.1)" x="1116.5" y="140">no</text></g></svg>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="124.5" height="20"><linearGradient id="smooth" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="round"><rect width="124.5" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#round)"><rect width="100.8" height="20" fill="#555"/><rect x="100.8" width="23.7" height="20" fill="#007ec6"/><rect width="124.5" height="20" fill="url(#smooth)"/></g><g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="110"><image x="5" y="3" width="14" height="14" xlink:href="https://dev.w3.org/SVG/tools/svgweb/samples/svg-files/python.svg"/><text x="599.0" y="150" fill="#010101" fill-opacity=".3" transform="scale(0.1)" textLength="738.0" lengthAdjust="spacing">--embed-logo</text><text x="599.0" y="140" transform="scale(0.1)" textLength="738.0" lengthAdjust="spacing">--embed-logo</text><text x="1116.5" y="150" fill="#010101" fill-opacity=".3" transform="scale(0.1)" textLength="137.0" lengthAdjust="spacing">no</text><text x="1116.5" y="140" transform="scale(0.1)" textLength="137.0" lengthAdjust="spacing">no</text></g></svg>

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@@ -1 +1 @@
<svg height="20" width="127.30000000000001" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><linearGradient id="smooth" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="round"><rect fill="#fff" height="20" rx="3" width="127.30000000000001"/></clipPath><g clip-path="url(#round)"><rect fill="#555" height="20" width="63.6"/><rect fill="#007ec6" height="20" width="63.7" x="63.6"/><rect fill="url(#smooth)" height="20" width="127.30000000000001"/></g><g fill="#fff" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="110" text-anchor="middle"><text fill="#010101" fill-opacity=".3" lengthAdjust="spacing" textLength="536.0" transform="scale(0.1)" x="328.0" y="150">pip install</text><text lengthAdjust="spacing" textLength="536.0" transform="scale(0.1)" x="328.0" y="140">pip install</text><text fill="#010101" fill-opacity=".3" lengthAdjust="spacing" textLength="537.0" transform="scale(0.1)" x="944.5" y="150">pybadges</text><text lengthAdjust="spacing" textLength="537.0" transform="scale(0.1)" x="944.5" y="140">pybadges</text><a xlink:href="https://pip.pypa.io/en/stable/installing/"><rect fill="rgba(0,0,0,0)" height="20" width="63.6"/></a><a xlink:href="https://pypi.org/project/pybadges/"><rect fill="rgba(0,0,0,0)" height="20" width="63.7" x="63.6"/></a></g></svg>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="127.30000000000001" height="20"><linearGradient id="smooth" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="round"><rect width="127.30000000000001" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#round)"><rect width="63.6" height="20" fill="#555"/><rect x="63.6" width="63.7" height="20" fill="#007ec6"/><rect width="127.30000000000001" height="20" fill="url(#smooth)"/></g><g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="110"><text x="328.0" y="150" fill="#010101" fill-opacity=".3" transform="scale(0.1)" textLength="536.0" lengthAdjust="spacing">pip install</text><text x="328.0" y="140" transform="scale(0.1)" textLength="536.0" lengthAdjust="spacing">pip install</text><text x="944.5" y="150" fill="#010101" fill-opacity=".3" transform="scale(0.1)" textLength="537.0" lengthAdjust="spacing">pybadges</text><text x="944.5" y="140" transform="scale(0.1)" textLength="537.0" lengthAdjust="spacing">pybadges</text><a xlink:href="https://pip.pypa.io/en/stable/installing/"><rect width="63.6" height="20" fill="rgba(0,0,0,0)"/></a><a xlink:href="https://pypi.org/project/pybadges/"><rect x="63.6" width="63.7" height="20" fill="rgba(0,0,0,0)"/></a></g></svg>

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@@ -1 +1 @@
<svg height="20" width="191.0" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><linearGradient id="smooth" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="round"><rect fill="#fff" height="20" rx="3" width="191.0"/></clipPath><g clip-path="url(#round)"><rect fill="#555" height="20" width="65.5"/><rect fill="#007ec6" height="20" width="125.5" x="65.5"/><rect fill="url(#smooth)" height="20" width="191.0"/></g><g fill="#fff" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="110" text-anchor="middle"><image height="14" width="14" x="5" xlink:href="https://dev.w3.org/SVG/tools/svgweb/samples/svg-files/python.svg" y="3"/><text fill="#010101" fill-opacity=".3" lengthAdjust="spacing" textLength="385.0" transform="scale(0.1)" x="422.5" y="150">python</text><text lengthAdjust="spacing" textLength="385.0" transform="scale(0.1)" x="422.5" y="140">python</text><text fill="#010101" fill-opacity=".3" lengthAdjust="spacing" textLength="1155.0" transform="scale(0.1)" x="1272.5" y="150">3.2, 3.3, 3.4, 3.5, 3.6</text><text lengthAdjust="spacing" textLength="1155.0" transform="scale(0.1)" x="1272.5" y="140">3.2, 3.3, 3.4, 3.5, 3.6</text><a xlink:href=""><rect fill="rgba(0,0,0,0)" height="20" width="65.5"/></a><a xlink:href="https://www.python.org/"><rect fill="rgba(0,0,0,0)" height="20" width="125.5" x="65.5"/></a></g></svg>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="191.0" height="20"><linearGradient id="smooth" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="round"><rect width="191.0" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#round)"><rect width="65.5" height="20" fill="#555"/><rect x="65.5" width="125.5" height="20" fill="#007ec6"/><rect width="191.0" height="20" fill="url(#smooth)"/></g><g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="110"><image x="5" y="3" width="14" height="14" xlink:href="https://dev.w3.org/SVG/tools/svgweb/samples/svg-files/python.svg"/><text x="422.5" y="150" fill="#010101" fill-opacity=".3" transform="scale(0.1)" textLength="385.0" lengthAdjust="spacing">python</text><text x="422.5" y="140" transform="scale(0.1)" textLength="385.0" lengthAdjust="spacing">python</text><text x="1272.5" y="150" fill="#010101" fill-opacity=".3" transform="scale(0.1)" textLength="1155.0" lengthAdjust="spacing">3.2, 3.3, 3.4, 3.5, 3.6</text><text x="1272.5" y="140" transform="scale(0.1)" textLength="1155.0" lengthAdjust="spacing">3.2, 3.3, 3.4, 3.5, 3.6</text><a xlink:href=""><rect width="65.5" height="20" fill="rgba(0,0,0,0)"/></a><a xlink:href="https://www.python.org/"><rect x="65.5" width="125.5" height="20" fill="rgba(0,0,0,0)"/></a></g></svg>

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@@ -1 +1 @@
<svg height="20" width="306.4" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><linearGradient id="smooth" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="round"><rect fill="#fff" height="20" rx="3" width="306.4"/></clipPath><g clip-path="url(#round)"><rect fill="#555" height="20" width="46.0"/><rect fill="#007ec6" height="20" width="260.4" x="46.0"/><rect fill="url(#smooth)" height="20" width="306.4"/></g><g fill="#fff" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="110" text-anchor="middle"><text fill="#010101" fill-opacity=".3" lengthAdjust="spacing" textLength="360.0" transform="scale(0.1)" x="240.0" y="150">saying</text><text lengthAdjust="spacing" textLength="360.0" transform="scale(0.1)" x="240.0" y="140">saying</text><text fill="#010101" fill-opacity=".3" lengthAdjust="spacing" textLength="2504.0" transform="scale(0.1)" x="1752.0" y="150">أباد الله خضراءهم ابذل لصديقك دمك ومالك</text><text lengthAdjust="spacing" textLength="2504.0" transform="scale(0.1)" x="1752.0" y="140">أباد الله خضراءهم ابذل لصديقك دمك ومالك</text></g></svg>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="306.4" height="20"><linearGradient id="smooth" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="round"><rect width="306.4" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#round)"><rect width="46.0" height="20" fill="#555"/><rect x="46.0" width="260.4" height="20" fill="#007ec6"/><rect width="306.4" height="20" fill="url(#smooth)"/></g><g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="110"><text x="240.0" y="150" fill="#010101" fill-opacity=".3" transform="scale(0.1)" textLength="360.0" lengthAdjust="spacing">saying</text><text x="240.0" y="140" transform="scale(0.1)" textLength="360.0" lengthAdjust="spacing">saying</text><text x="1752.0" y="150" fill="#010101" fill-opacity=".3" transform="scale(0.1)" textLength="2504.0" lengthAdjust="spacing">أباد الله خضراءهم ابذل لصديقك دمك ومالك</text><text x="1752.0" y="140" transform="scale(0.1)" textLength="2504.0" lengthAdjust="spacing">أباد الله خضراءهم ابذل لصديقك دمك ومالك</text></g></svg>

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@@ -1 +1 @@
<svg height="20" width="334.90003386386746" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><linearGradient id="smooth" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="round"><rect fill="#fff" height="20" rx="3" width="334.90003386386746"/></clipPath><g clip-path="url(#round)"><rect fill="#555" height="20" width="46.0"/><rect fill="#007ec6" height="20" width="288.90003386386746" x="46.0"/><rect fill="url(#smooth)" height="20" width="334.90003386386746"/></g><g fill="#fff" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="110" text-anchor="middle"><text fill="#010101" fill-opacity=".3" lengthAdjust="spacing" textLength="360.0" transform="scale(0.1)" x="240.0" y="150">saying</text><text lengthAdjust="spacing" textLength="360.0" transform="scale(0.1)" x="240.0" y="140">saying</text><text fill="#010101" fill-opacity=".3" lengthAdjust="spacing" textLength="2789.0003386386747" transform="scale(0.1)" x="1894.5001693193374" y="150">不聞不若聞之,聞之不若見之,見之不若知之,知之不若行之;學至於行之而止矣</text><text lengthAdjust="spacing" textLength="2789.0003386386747" transform="scale(0.1)" x="1894.5001693193374" y="140">不聞不若聞之,聞之不若見之,見之不若知之,知之不若行之;學至於行之而止矣</text></g></svg>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="334.90003386386746" height="20"><linearGradient id="smooth" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="round"><rect width="334.90003386386746" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#round)"><rect width="46.0" height="20" fill="#555"/><rect x="46.0" width="288.90003386386746" height="20" fill="#007ec6"/><rect width="334.90003386386746" height="20" fill="url(#smooth)"/></g><g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="110"><text x="240.0" y="150" fill="#010101" fill-opacity=".3" transform="scale(0.1)" textLength="360.0" lengthAdjust="spacing">saying</text><text x="240.0" y="140" transform="scale(0.1)" textLength="360.0" lengthAdjust="spacing">saying</text><text x="1894.5001693193374" y="150" fill="#010101" fill-opacity=".3" transform="scale(0.1)" textLength="2789.0003386386747" lengthAdjust="spacing">不聞不若聞之,聞之不若見之,見之不若知之,知之不若行之;學至於行之而止矣</text><text x="1894.5001693193374" y="140" transform="scale(0.1)" textLength="2789.0003386386747" lengthAdjust="spacing">不聞不若聞之,聞之不若見之,見之不若知之,知之不若行之;學至於行之而止矣</text></g></svg>

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@@ -1 +1 @@
<svg height="20" width="319.7" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><linearGradient id="smooth" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="round"><rect fill="#fff" height="20" rx="3" width="319.7"/></clipPath><g clip-path="url(#round)"><rect fill="#555" height="20" width="46.0"/><rect fill="#007ec6" height="20" width="273.7" x="46.0"/><rect fill="url(#smooth)" height="20" width="319.7"/></g><g fill="#fff" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="110" text-anchor="middle"><text fill="#010101" fill-opacity=".3" lengthAdjust="spacing" textLength="360.0" transform="scale(0.1)" x="240.0" y="150">saying</text><text lengthAdjust="spacing" textLength="360.0" transform="scale(0.1)" x="240.0" y="140">saying</text><text fill="#010101" fill-opacity=".3" lengthAdjust="spacing" textLength="2637.0" transform="scale(0.1)" x="1818.5" y="150">Без труда́ не вы́тащишь и ры́бку из пруда́.</text><text lengthAdjust="spacing" textLength="2637.0" transform="scale(0.1)" x="1818.5" y="140">Без труда́ не вы́тащишь и ры́бку из пруда́.</text></g></svg>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="319.7" height="20"><linearGradient id="smooth" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="round"><rect width="319.7" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#round)"><rect width="46.0" height="20" fill="#555"/><rect x="46.0" width="273.7" height="20" fill="#007ec6"/><rect width="319.7" height="20" fill="url(#smooth)"/></g><g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="110"><text x="240.0" y="150" fill="#010101" fill-opacity=".3" transform="scale(0.1)" textLength="360.0" lengthAdjust="spacing">saying</text><text x="240.0" y="140" transform="scale(0.1)" textLength="360.0" lengthAdjust="spacing">saying</text><text x="1818.5" y="150" fill="#010101" fill-opacity=".3" transform="scale(0.1)" textLength="2637.0" lengthAdjust="spacing">Без труда́ не вы́тащишь и ры́бку из пруда́.</text><text x="1818.5" y="140" transform="scale(0.1)" textLength="2637.0" lengthAdjust="spacing">Без труда́ не вы́тащишь и ры́бку из пруда́.</text></g></svg>

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@@ -1 +1 @@
<svg height="20" width="65.2" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><linearGradient id="smooth" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="round"><rect fill="#fff" height="20" rx="3" width="65.2"/></clipPath><g clip-path="url(#round)"><rect fill="#555" height="20" width="43.7"/><rect fill="#007ec6" height="20" width="21.5" x="43.7"/><rect fill="url(#smooth)" height="20" width="65.2"/></g><g fill="#fff" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="110" text-anchor="middle"><text fill="#010101" fill-opacity=".3" lengthAdjust="spacing" textLength="337.0" transform="scale(0.1)" x="228.5" y="150">status</text><text lengthAdjust="spacing" textLength="337.0" transform="scale(0.1)" x="228.5" y="140">status</text><text fill="#010101" fill-opacity=".3" lengthAdjust="spacing" textLength="115.0" transform="scale(0.1)" x="534.5" y="150"></text><text lengthAdjust="spacing" textLength="115.0" transform="scale(0.1)" x="534.5" y="140"></text></g></svg>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="65.2" height="20"><linearGradient id="smooth" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="round"><rect width="65.2" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#round)"><rect width="43.7" height="20" fill="#555"/><rect x="43.7" width="21.5" height="20" fill="#007ec6"/><rect width="65.2" height="20" fill="url(#smooth)"/></g><g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="110"><text x="228.5" y="150" fill="#010101" fill-opacity=".3" transform="scale(0.1)" textLength="337.0" lengthAdjust="spacing">status</text><text x="228.5" y="140" transform="scale(0.1)" textLength="337.0" lengthAdjust="spacing">status</text><text x="534.5" y="150" fill="#010101" fill-opacity=".3" transform="scale(0.1)" textLength="115.0" lengthAdjust="spacing"></text><text x="534.5" y="140" transform="scale(0.1)" textLength="115.0" lengthAdjust="spacing"></text></g></svg>

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -1 +1 @@
<svg height="20" width="218.8" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><linearGradient id="smooth" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="round"><rect fill="#fff" height="20" rx="3" width="218.8"/></clipPath><g clip-path="url(#round)"><rect fill="#007ec6" height="20" width="36.8"/><rect fill="#fe7d37" height="20" width="182.0" x="36.8"/><rect fill="url(#smooth)" height="20" width="218.8"/></g><g fill="#fff" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="110" text-anchor="middle"><text fill="#010101" fill-opacity=".3" lengthAdjust="spacing" textLength="268.0" transform="scale(0.1)" x="194.0" y="150">tests</text><text lengthAdjust="spacing" textLength="268.0" transform="scale(0.1)" x="194.0" y="140">tests</text><text fill="#010101" fill-opacity=".3" lengthAdjust="spacing" textLength="1720.0" transform="scale(0.1)" x="1268.0" y="150">231 passed, 1 failed, 1 skipped</text><text lengthAdjust="spacing" textLength="1720.0" transform="scale(0.1)" x="1268.0" y="140">231 passed, 1 failed, 1 skipped</text></g></svg>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="218.8" height="20"><linearGradient id="smooth" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="round"><rect width="218.8" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#round)"><rect width="36.8" height="20" fill="#007ec6"/><rect x="36.8" width="182.0" height="20" fill="#fe7d37"/><rect width="218.8" height="20" fill="url(#smooth)"/></g><g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="110"><text x="194.0" y="150" fill="#010101" fill-opacity=".3" transform="scale(0.1)" textLength="268.0" lengthAdjust="spacing">tests</text><text x="194.0" y="140" transform="scale(0.1)" textLength="268.0" lengthAdjust="spacing">tests</text><text x="1268.0" y="150" fill="#010101" fill-opacity=".3" transform="scale(0.1)" textLength="1720.0" lengthAdjust="spacing">231 passed, 1 failed, 1 skipped</text><text x="1268.0" y="140" transform="scale(0.1)" textLength="1720.0" lengthAdjust="spacing">231 passed, 1 failed, 1 skipped</text></g></svg>

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

51
tests/image_server.py Normal file
View File

@@ -0,0 +1,51 @@
# Copyright 2022 The pybadge Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""An HTTP image server that can be used to set logo embedding.
The server will respond to any request with the image data provided in the
constructor.
"""
from http import server
import threading
class ImageServer:
def __init__(self, image_data):
self._image_data = image_data
def start_server(self):
srv = self
class Handler(server.BaseHTTPRequestHandler):
def do_GET(self):
self.send_response(200)
self.send_header('Content-Type', 'image/png')
self.end_headers()
self.wfile.write(srv._image_data)
self._httpd = server.HTTPServer(('localhost', 0), Handler)
self.logo_url = "http://localhost:{0}".format(self._httpd.server_port)
thread = threading.Thread(target=self._httpd.serve_forever)
thread.start()
def fix_embedded_url_reference(self, example):
if example.get("logo") == "<embedded>":
example["logo"] = self.logo_url
def stop_server(self):
self._httpd.shutdown()

View File

@@ -17,13 +17,14 @@ import base64
import doctest
import json
import os.path
import unittest
import pathlib
import sys
import tempfile
import unittest
import xmldiff.main
import pybadges
from tests import image_server
TEST_DIR = os.path.dirname(__file__)
@@ -36,6 +37,15 @@ PNG_IMAGE = base64.b64decode(PNG_IMAGE_B64)
class TestPybadgesBadge(unittest.TestCase):
"""Tests for pybadges.badge."""
def setUp(self):
super().setUp()
self._image_server = image_server.ImageServer(PNG_IMAGE)
self._image_server.start_server()
def tearDown(self):
super().tearDown()
self._image_server.stop_server()
def test_docs(self):
doctest.testmod(pybadges, optionflags=doctest.ELLIPSIS)
@@ -51,6 +61,7 @@ class TestPybadgesBadge(unittest.TestCase):
examples = json.load(f)
for example in examples:
self._image_server.fix_embedded_url_reference(example)
file_name = example.pop('file_name')
with self.subTest(example=file_name):
goldenpath = os.path.join(TEST_DIR, 'golden-images', file_name)
@@ -81,8 +92,6 @@ class TestPybadgesBadge(unittest.TestCase):
"images for %s differ:\n%s\nview with:\npython -m webbrowser %s"
% (file_name, diff, html.name))
self.assertFalse(diff,)
class TestEmbedImage(unittest.TestCase):
"""Tests for pybadges._embed_image."""