forked from orsinium-labs/svg.py
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
119 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
from pathlib import Path | ||
|
||
PROJECT_ROOT = Path(__file__).parent.parent.absolute() | ||
|
||
|
||
def get_attrs_ref_root() -> Path: | ||
mdn_root = PROJECT_ROOT.parent / 'mdn-source' | ||
svg_ref_root = mdn_root / 'files' / 'en-us' / 'web' / 'svg' | ||
return svg_ref_root / 'attribute' | ||
|
||
|
||
def is_deprecated(path: Path) -> bool: | ||
path /= 'index.html' | ||
if not path.is_file(): | ||
return False | ||
content = path.read_text() | ||
return '{{Deprecated_Header}}' in content | ||
|
||
|
||
def run() -> None: | ||
out_path = PROJECT_ROOT / 'tests' / 'fixtures' / 'deprecated.txt' | ||
with out_path.open('w') as out_stream: | ||
for ref_path in get_attrs_ref_root().iterdir(): | ||
if is_deprecated(ref_path): | ||
print(ref_path.name, file=out_stream) | ||
|
||
|
||
if __name__ == '__main__': | ||
run() |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
u2 | ||
v-ideographic | ||
format | ||
glyph-orientation-horizontal | ||
k | ||
unicode-range | ||
vert-adv-y | ||
cap-height | ||
xlink_colon_show | ||
g2 | ||
attributetype | ||
glyphref | ||
string | ||
g1 | ||
xlink_colon_title | ||
panose-1 | ||
glyph-name | ||
hanging | ||
v-hanging | ||
xlink_colon_type | ||
slope | ||
unicode | ||
u1 | ||
xml_colon_space | ||
baseprofile | ||
xlink_colon_arcrole | ||
horiz-origin-y | ||
zoomandpan | ||
kernelunitlength | ||
xml_colon_base | ||
orientation | ||
stemv | ||
version | ||
v-alphabetic | ||
horiz-origin-x | ||
vert-origin-y | ||
glyph-orientation-vertical | ||
stemh | ||
v-mathematical | ||
vert-origin-x | ||
ideographic | ||
kerning | ||
requiredfeatures | ||
mathematical | ||
color-profile | ||
name | ||
arabic-form | ||
units-per-em | ||
widths | ||
viewtarget | ||
x-height | ||
descent | ||
enable-background | ||
xlink_colon_href | ||
horiz-adv-x |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
|
||
from dataclasses import fields | ||
from typing import Set | ||
from pathlib import Path | ||
import pytest | ||
|
||
import svg | ||
from svg._mixins import AttrsMixin | ||
|
||
|
||
FIXTURES = Path(__file__).parent / 'fixtures' | ||
DEPRECATED = (FIXTURES / 'deprecated.txt').read_text().split() | ||
|
||
|
||
def get_attrs(cls) -> Set[str]: | ||
result = set() | ||
for field in fields(cls): | ||
key = field.name | ||
if key == 'elements': | ||
continue | ||
key = key.rstrip('_') | ||
key = key.replace('__', ':') | ||
key = key.replace('_', '-') | ||
result.add(key) | ||
return result | ||
|
||
|
||
@pytest.mark.parametrize('cls', AttrsMixin.__subclasses__()) | ||
@pytest.mark.parametrize('name', DEPRECATED) | ||
def test_no_deprecated_mixins(cls: AttrsMixin, name: str): | ||
name = name.replace('_colon_', ':') | ||
attrs = get_attrs(cls) | ||
assert name not in attrs |