mirror of
https://github.com/suyiiyii/nonebot-bison.git
synced 2025-06-05 11:26:43 +08:00
use coverage
This commit is contained in:
parent
d6192153da
commit
c62a8d2f5e
@ -12,10 +12,7 @@ orbs:
|
|||||||
workflows:
|
workflows:
|
||||||
build-test-publish:
|
build-test-publish:
|
||||||
jobs:
|
jobs:
|
||||||
- python/test:
|
- test:
|
||||||
pkg-manager: poetry
|
|
||||||
test-tool: pytest
|
|
||||||
version: "3.9"
|
|
||||||
filters:
|
filters:
|
||||||
tags:
|
tags:
|
||||||
only: /.*/
|
only: /.*/
|
||||||
@ -29,29 +26,24 @@ workflows:
|
|||||||
only: /^v.*/
|
only: /^v.*/
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
# test:
|
test:
|
||||||
# docker:
|
docker:
|
||||||
# - image: cimg/python:3.9
|
- image: cimg/python:3.9
|
||||||
# steps:
|
steps:
|
||||||
# - checkout
|
- checkout
|
||||||
# # - run: sed -e '41,45d' -i pyproject.toml
|
# - run: sed -e '41,45d' -i pyproject.toml
|
||||||
# - restore_cache:
|
- python/install-packages:
|
||||||
# keys:
|
pkg-manager: poetry
|
||||||
# - venv-cache-{{ checksum "poetry.lock" }}
|
- run:
|
||||||
# - run:
|
name: Coverage test
|
||||||
# name: Poetry install
|
command: poetry run coverage run -m pytest --junitxml=test-results/junit.xml
|
||||||
# command: |
|
- store_test_results:
|
||||||
# poetry config virtualenvs.in-project true
|
path: test-results
|
||||||
# poetry install -v
|
- run:
|
||||||
# - save_cache:
|
name: Collect coverage
|
||||||
# paths:
|
command: coverage html --include='src/*'
|
||||||
# - .venv
|
- store_artifacts:
|
||||||
# key: venv-cache-{{ checksum "poetry.lock" }}
|
path: htmlcov
|
||||||
# - run:
|
|
||||||
# name: pytest
|
|
||||||
# command: poetry run pytest --junitxml=test-results/junit.xml
|
|
||||||
# - store_test_results:
|
|
||||||
# path: test-results
|
|
||||||
build-publish:
|
build-publish:
|
||||||
docker:
|
docker:
|
||||||
- image: cimg/python:3.9
|
- image: cimg/python:3.9
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
|
|
||||||
[](https://pypi.org/project/nonebot-hk-reporter/)
|
[](https://pypi.org/project/nonebot-hk-reporter/)
|
||||||
[](https://circleci.com/gh/felinae98/nonebot-hk-reporter)
|
[](https://circleci.com/gh/felinae98/nonebot-hk-reporter)
|
||||||
[](https://qm.qq.com/cgi-bin/qm/qr?k=pXYMGB_e8b6so3QTqgeV6lkKDtEeYE4f&jump_from=webapi)
|
[](https://qm.qq.com/cgi-bin/qm/qr?k=pXYMGB_e8b6so3QTqgeV6lkKDtEeYE4f&jump_from=webapi)
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
@ -62,11 +62,12 @@ class Weibo(Platform):
|
|||||||
def get_tags(self, raw_post: RawPost) -> Optional[list[Tag]]:
|
def get_tags(self, raw_post: RawPost) -> Optional[list[Tag]]:
|
||||||
"Return Tag list of given RawPost"
|
"Return Tag list of given RawPost"
|
||||||
text = raw_post['mblog']['text']
|
text = raw_post['mblog']['text']
|
||||||
|
soup = bs(text, 'html.parser')
|
||||||
return list(map(
|
return list(map(
|
||||||
lambda x: x[1:-1],
|
lambda x: x[1:-1],
|
||||||
filter(
|
filter(
|
||||||
lambda s: s[0] == '#' and s[-1] == '#',
|
lambda s: s[0] == '#' and s[-1] == '#',
|
||||||
map(lambda x:x.text, text.find_all('span', class_='surl-text'))
|
map(lambda x:x.text, soup.find_all('span', class_='surl-text'))
|
||||||
)
|
)
|
||||||
))
|
))
|
||||||
|
|
||||||
|
@ -74,5 +74,6 @@ async def test_parse_long(weibo):
|
|||||||
assert(not '全文' in post.text)
|
assert(not '全文' in post.text)
|
||||||
assert(detail_router.called)
|
assert(detail_router.called)
|
||||||
|
|
||||||
def text_tag(weibo, weibo_ak_list_1):
|
def test_tag(weibo, weibo_ak_list_1):
|
||||||
assert(weibo.get_tags(weibo_ak_list_1) == ['明日方舟', '音律联觉'])
|
raw_post = weibo_ak_list_1['data']['cards'][0]
|
||||||
|
assert(weibo.get_tags(raw_post) == ['明日方舟', '音律联觉'])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user