diff --git a/Lib/glyphsets/__init__.py b/Lib/glyphsets/__init__.py index 241a9c0422..5108c0a763 100644 --- a/Lib/glyphsets/__init__.py +++ b/Lib/glyphsets/__init__.py @@ -43,15 +43,15 @@ def sort_unicodes_by_name(a, b): return 0 -def sort_unicodes_by_glyphobject(a, b): - if a.unicode and b.unicode: - return int(a.unicode, 16) - int(b.unicode, 16) - elif a.unicode: - return -1 - elif b.unicode: - return 1 - else: - return 0 +# def sort_unicodes_by_glyphobject(a, b): +# if a.unicode and b.unicode: +# return int(a.unicode, 16) - int(b.unicode, 16) +# elif a.unicode: +# return -1 +# elif b.unicode: +# return 1 +# else: +# return 0 def sort_by_category(a, b): @@ -661,6 +661,7 @@ def unicodes_per_glyphset(glyphset_name): return read_nam_file(nam_path) +# Public API (used by fontbakery, gftools, etc.) def glyphs_in_glyphsets(glyphset_names, production_names=False): glyphs = set() for glyphset_name in glyphset_names: @@ -669,6 +670,7 @@ def glyphs_in_glyphsets(glyphset_names, production_names=False): return sorted(list(glyphs)) +# Public API (used by fontbakery, gftools, etc.) def languages_per_glyphset(glyphset_name): return GlyphSet.load(glyphset_name).get_language_codes() diff --git a/coverage.sh b/coverage.sh new file mode 100644 index 0000000000..0bfe0bf1f0 --- /dev/null +++ b/coverage.sh @@ -0,0 +1,5 @@ +coverage run -m pytest +coverage run -a scripts/assemble_charactersets.py +coverage run -a scripts/assemble_description.py +coverage html +rm .coverage \ No newline at end of file diff --git a/tests/test_dependencies.py b/tests/test_dependencies.py deleted file mode 100644 index 86b6f8338a..0000000000 --- a/tests/test_dependencies.py +++ /dev/null @@ -1,28 +0,0 @@ -import os -import re -import requests -import json - -SETUP_PY = os.path.join(os.path.dirname(__file__), "..", "setup.py") -with open(SETUP_PY, "r") as f: - setup_py = f.read() - - -def get_setup_py_version(package_name): - version = re.findall( - rf"{package_name}(>=|~=|==)([0-9]+\.[0-9]+\.[0-9]+)", - setup_py, - ) - return version[0][1] - - -def get_latest_version(package_name): - return json.loads(requests.get(f"https://pypi.org/pypi/{package_name}/json").text)["info"]["version"] - - -def check_version(package_name): - setup_py_version = get_setup_py_version(package_name) - latest_version = get_latest_version(package_name) - assert ( - setup_py_version == latest_version - ), f"{package_name} version in setup.py is not the latest version on PyPI ({latest_version})" diff --git a/tests/test_glyphsets.py b/tests/test_glyphsets.py index 3175032f16..c7acbccf92 100644 --- a/tests/test_glyphsets.py +++ b/tests/test_glyphsets.py @@ -7,7 +7,8 @@ build_glyphsapp_filter_list, glyphs_in_glyphset, GlyphSet, - extended_glyphsets, + analyze_font, + find_character, ) import plistlib @@ -53,6 +54,7 @@ def test_coverage(): ttFont = TTFont(FONT_PATH) assert get_glyphsets_fulfilled(ttFont)["GF_Latin_Core"]["percentage"] > 0.99 + analyze_font(ttFont) def test_compare(): @@ -72,3 +74,8 @@ def test_filter_lists(): assert test[1]["list"] == glyphs_in_glyphset("GF_Latin_Kernel") assert test[2]["list"] == glyphs_in_glyphset("GF_Latin_Plus") os.remove("CustomFiltertest.plist") + + +def test_find(): + find_character("ß") + find_character("0x00DF")