43 lines
1.6 KiB
Python
43 lines
1.6 KiB
Python
|
|
# -*- coding: utf-8 -*-
|
||
|
|
"""QA: count target emoji in dist assets"""
|
||
|
|
import sys
|
||
|
|
|
||
|
|
FILES = [
|
||
|
|
r"D:\资料\03-项目开发\wecom_it_smart_desk\src\frontend-agent\dist\assets\index-C9eNZBP_.js",
|
||
|
|
r"D:\资料\03-项目开发\wecom_it_smart_desk\src\frontend-agent\dist\assets\Workspace-C-lLbDyz.js",
|
||
|
|
r"D:\资料\03-项目开发\wecom_it_smart_desk\src\frontend-agent\dist\assets\index-DAn-Mowv.css",
|
||
|
|
]
|
||
|
|
|
||
|
|
EMOJIS = ["💡", "🎚️", "🖌️", "🔄", "✨", "🎭", "✏️"]
|
||
|
|
|
||
|
|
def main():
|
||
|
|
totals = {e: 0 for e in EMOJIS}
|
||
|
|
per_file = {}
|
||
|
|
for f in FILES:
|
||
|
|
try:
|
||
|
|
with open(f, encoding="utf-8") as fh:
|
||
|
|
data = fh.read()
|
||
|
|
except Exception as ex:
|
||
|
|
print("ERR", f, ex)
|
||
|
|
continue
|
||
|
|
per_file[f] = {}
|
||
|
|
for e in EMOJIS:
|
||
|
|
c = data.count(e)
|
||
|
|
per_file[f][e] = c
|
||
|
|
totals[e] += c
|
||
|
|
print("FILE:", f.split("assets")[-1], "chars:", len(data))
|
||
|
|
print(" ", {e: per_file[f][e] for e in EMOJIS})
|
||
|
|
print("TOTAL:", totals)
|
||
|
|
# assert engineer claims
|
||
|
|
assert totals["💡"] == 4, f"💡 expected 4 got {totals['💡']}"
|
||
|
|
assert totals["🎚️"] == 1, f"🎚️ expected 1 got {totals['🎚️']}"
|
||
|
|
assert totals["🖌️"] == 2, f"🖌️ expected 2 got {totals['🖌️']}"
|
||
|
|
assert totals["🔄"] == 7, f"🔄 expected 7 got {totals['🔄']}"
|
||
|
|
assert totals["✨"] == 0, f"✨ expected 0 got {totals['✨']}"
|
||
|
|
assert totals["🎭"] == 0, f"🎭 expected 0 got {totals['🎭']}"
|
||
|
|
assert totals["✏️"] == 1, f"✏️ expected 1 got {totals['✏️']}"
|
||
|
|
print("ALL EMOJI ASSERTIONS PASSED")
|
||
|
|
|
||
|
|
if __name__ == "__main__":
|
||
|
|
main()
|