who cares
This commit is contained in:
4
.gitignore
vendored
4
.gitignore
vendored
@ -1,3 +1,7 @@
|
|||||||
|
.vscode/
|
||||||
|
.debug/
|
||||||
|
debug*.py
|
||||||
|
|
||||||
# Byte-compiled / optimized / DLL files
|
# Byte-compiled / optimized / DLL files
|
||||||
__pycache__/
|
__pycache__/
|
||||||
*.py[cod]
|
*.py[cod]
|
||||||
|
7
noxfile.py
Normal file
7
noxfile.py
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
import nox
|
||||||
|
|
||||||
|
|
||||||
|
@nox.session
|
||||||
|
def tests(session: nox.Session) -> None:
|
||||||
|
session.install("pytest")
|
||||||
|
session.run("pytest", "--doctest-modules", "arcaea_apk_assets")
|
@ -8,27 +8,19 @@ build-backend = "setuptools.build_meta"
|
|||||||
# dynamic = ["version"]
|
# dynamic = ["version"]
|
||||||
name = "arcaea-apk-assets"
|
name = "arcaea-apk-assets"
|
||||||
description = "Your package description goes here."
|
description = "Your package description goes here."
|
||||||
version = "0.1.0a"
|
version = "0.1.0a.dev1"
|
||||||
requires-python = ">=3.9"
|
requires-python = ">=3.9"
|
||||||
authors = [
|
authors = [{ name = "283375", email = "log_283375@163.com" }]
|
||||||
{name = "283375", email = "log_283375@163.com"},
|
|
||||||
]
|
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
license = "GPL-3.0-or-later"
|
license = "GPL-3.0-or-later"
|
||||||
|
|
||||||
|
[project.urls]
|
||||||
|
Homepage = "https://github.com/283375/arcaea-apk-assets"
|
||||||
|
Issues = "https://github.com/283375/arcaea-apk-assets/issues"
|
||||||
|
|
||||||
[tool.ruff.lint]
|
[tool.ruff.lint]
|
||||||
select = [
|
select = ["ALL"]
|
||||||
"E", # pycodestyle
|
|
||||||
"F", # Pyflakes
|
|
||||||
"UP", # pyupgrade
|
|
||||||
"B", # flake8-bugbear
|
|
||||||
"SIM", # flake8-simplify
|
|
||||||
"I", # isort
|
|
||||||
"RET", # flake8-return
|
|
||||||
"EM", # flake8-errmsg
|
|
||||||
"CPY", # flake8-copyright
|
|
||||||
"RUF", # Ruff-specific rules
|
|
||||||
]
|
|
||||||
ignore = [
|
ignore = [
|
||||||
"E501", # line-too-long
|
"D",
|
||||||
|
"E501", # line-too-long
|
||||||
]
|
]
|
||||||
|
0
tests/__init__.py
Normal file
0
tests/__init__.py
Normal file
0
tests/contents/__init__.py
Normal file
0
tests/contents/__init__.py
Normal file
52
tests/contents/packlist.py
Normal file
52
tests/contents/packlist.py
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
# ruff: noqa: RUF001
|
||||||
|
|
||||||
|
NORMAL = {
|
||||||
|
"packs": [
|
||||||
|
{
|
||||||
|
"id": "test",
|
||||||
|
"section": "mainstory",
|
||||||
|
"is_extend_pack": False,
|
||||||
|
"is_active_extend_pack": False,
|
||||||
|
"custom_banner": True,
|
||||||
|
"small_pack_image": False,
|
||||||
|
"plus_character": -1,
|
||||||
|
"name_localized": {"en": "Test Collection 1"},
|
||||||
|
"description_localized": {
|
||||||
|
"en": "DIVINE GRACE, AWAITS YOU IN A LOST WORLD, OF SILENT SONG...",
|
||||||
|
"ja": "「光」も「対立」も全都有、「钙麻」失われた世界で、あなたを待ち受ける⋯",
|
||||||
|
"ko": "고통이 고통이라는 이유로 그 자체를 사랑하고 소유하려는 자는 없다",
|
||||||
|
"zh-Hant": "神的恩典,在一個失去的世界等你,介詞安靜的歌曲……",
|
||||||
|
"zh-Hans": "神的恩典,在一个失去的世界等你,介词安静的歌曲……",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "test_other_properties",
|
||||||
|
"section": "archive",
|
||||||
|
"is_extend_pack": True,
|
||||||
|
"is_active_extend_pack": False,
|
||||||
|
"custom_banner": True,
|
||||||
|
"small_pack_image": True,
|
||||||
|
"plus_character": 123,
|
||||||
|
"name_localized": {"en": "Test Collection 1 - Archive"},
|
||||||
|
"description_localized": {
|
||||||
|
"en": "A FADING LIGHT, AWAITS YOU IN A PURE MEMORY WORLD, OF MUSICAL CONFLICT...",
|
||||||
|
"ja": "「消えゆく光」が、「ピュア・メモリー」に満ちた世界が、あなたを待ち受ける⋯",
|
||||||
|
"ko": "혹은 아무런 즐거움도 생기지 않는 고통을 회피하는 사람을 누가 탓할 수 있겠는가?",
|
||||||
|
"zh-Hant": "一個消色的光,在一個“純 淨 回 憶”的世界等你,介詞音樂的衝突……",
|
||||||
|
"zh-Hans": "一个消色的光,在一个“纯 净 回 忆”的世界等你,介词音乐的冲突……",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
MALFORMED_WTF = {
|
||||||
|
"wow": [],
|
||||||
|
"random": {},
|
||||||
|
"parts!": "huh?",
|
||||||
|
}
|
||||||
|
MALFORMED_ROOT = {
|
||||||
|
"packs": {
|
||||||
|
"pack1": "something",
|
||||||
|
"pack2": "otherthing",
|
||||||
|
},
|
||||||
|
}
|
27
tests/test_packlist.py
Normal file
27
tests/test_packlist.py
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
import pytest
|
||||||
|
|
||||||
|
from arcaea_apk_assets.parsers.packlist import ArcaeaPacklistParser, PacklistFormatError
|
||||||
|
from tests.contents import packlist as contents
|
||||||
|
|
||||||
|
|
||||||
|
class TestPacklistParser:
|
||||||
|
def test_normal(self):
|
||||||
|
content = contents.NORMAL
|
||||||
|
|
||||||
|
ArcaeaPacklistParser.packs(content)
|
||||||
|
|
||||||
|
def test_malformed(self):
|
||||||
|
with pytest.raises(PacklistFormatError, match="does not exist"):
|
||||||
|
ArcaeaPacklistParser.items(contents.MALFORMED_WTF)
|
||||||
|
|
||||||
|
with pytest.raises(PacklistFormatError, match="got"):
|
||||||
|
ArcaeaPacklistParser.items(contents.MALFORMED_ROOT)
|
||||||
|
|
||||||
|
assert (
|
||||||
|
len(ArcaeaPacklistParser.items(contents.MALFORMED_WTF, skip_asserts=True))
|
||||||
|
== 0
|
||||||
|
)
|
||||||
|
assert (
|
||||||
|
len(ArcaeaPacklistParser.items(contents.MALFORMED_ROOT, skip_asserts=True))
|
||||||
|
== 0
|
||||||
|
)
|
Reference in New Issue
Block a user