chore: update __all__
, fix tests
This commit is contained in:
parent
2cdda43cea
commit
2580e4cbfe
@ -1,7 +1,5 @@
|
||||
from dataclasses import dataclass
|
||||
from http.cookiejar import LoadError, MozillaCookieJar
|
||||
from json import dumps as dumpJson
|
||||
from typing import Iterable
|
||||
|
||||
from httpx import Client as HttpXClient
|
||||
from httpx import Request as HttpXRequest
|
||||
@ -14,6 +12,8 @@ from .error import (
|
||||
)
|
||||
from .object import NCMAlbum, NCMLyrics, NCMPlaylist, NCMTrack
|
||||
|
||||
__all__ = ["NCMApi"]
|
||||
|
||||
REQUEST_HEADERS = {
|
||||
"Accept": "application/json",
|
||||
"Accept-Encoding": "zstd, br, gzip, deflate",
|
||||
|
@ -1,5 +1,16 @@
|
||||
from httpx import RequestError
|
||||
|
||||
__all__ = [
|
||||
"NCMLyricsAppError",
|
||||
"NCMApiError",
|
||||
"NCMApiRequestError",
|
||||
"NCMApiRetryLimitExceededError",
|
||||
"ObjectParseError",
|
||||
"ParseLinkError",
|
||||
"UnsupportedLinkError",
|
||||
"UnsupportedPureMusicTrackError",
|
||||
]
|
||||
|
||||
|
||||
class NCMLyricsAppError(Exception):
|
||||
"""NCMLyrics 错误"""
|
||||
|
@ -10,7 +10,7 @@ from .enum import LrcMetaType, LrcType
|
||||
from .error import UnsupportedPureMusicTrackError
|
||||
from .object import NCMLyrics
|
||||
|
||||
__all__ = ["LrcType", "LrcMetaType", "Lrc"]
|
||||
__all__ = ["Lrc"]
|
||||
|
||||
LRC_RE_COMMIT = reCompile(r"^\s*#")
|
||||
LRC_RE_META = reCompile(r"^\s*\[(?P<type>ti|ar|al|au|length|by|offset):\s*(?P<content>.+?)\s*\]\s*$")
|
||||
|
@ -10,6 +10,8 @@ from .enum import LinkType
|
||||
from .error import ParseLinkError, UnsupportedLinkError
|
||||
from .object import NCMTrack
|
||||
|
||||
__all__ = ["Link", "parseLink", "testExistTrackSource", "pickOutput"]
|
||||
|
||||
RE_ANDROID_ALBUM_SHARE_LINK_PATH = reCompile(r"^/album/(?P<id>\d*)/?$")
|
||||
RE_SAFE_FILENAME = reCompile(r"\*{2,}")
|
||||
TRANSLATER_SAFE_FILENAME = str.maketrans({i: 0x2A for i in ("<", ">", ":", '"', "/", "\\", "|", "?")})
|
||||
|
@ -1,9 +1,10 @@
|
||||
from pathlib import Path
|
||||
from unittest import TestCase
|
||||
|
||||
from ncmlyrics.api import NCMTrack
|
||||
from ncmlyrics.error import ParseLinkError, UnsupportLinkError
|
||||
from ncmlyrics.util import Link, LinkType, parseLink, pickOutput, testExistTrackSource
|
||||
from ncmlyrics.enum import LinkType
|
||||
from ncmlyrics.error import ParseLinkError, UnsupportedLinkError
|
||||
from ncmlyrics.object import NCMTrack
|
||||
from ncmlyrics.util import Link, parseLink, pickOutput, testExistTrackSource
|
||||
|
||||
|
||||
class TestUtils(TestCase):
|
||||
@ -73,19 +74,19 @@ class TestUtils(TestCase):
|
||||
|
||||
def test_parseLink_UnsupportShareLinkError(self):
|
||||
self.assertRaises(
|
||||
UnsupportLinkError,
|
||||
UnsupportedLinkError,
|
||||
parseLink,
|
||||
"https://www.google.com/",
|
||||
)
|
||||
|
||||
self.assertRaises(
|
||||
UnsupportLinkError,
|
||||
UnsupportedLinkError,
|
||||
parseLink,
|
||||
"https://music.163.com/unsupport?id=123",
|
||||
)
|
||||
|
||||
self.assertRaises(
|
||||
UnsupportLinkError,
|
||||
UnsupportedLinkError,
|
||||
parseLink,
|
||||
"https://music.163.com/album/123a",
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user