Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
crj1998
meetslut
提交
8e572721
M
meetslut
项目概览
crj1998
/
meetslut
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
meetslut
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
8e572721
编写于
11月 05, 2022
作者:
C
crj1998
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add test
上级
6fb6a1ff
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
57 addition
and
10 deletion
+57
-10
meetslut/cli.py
meetslut/cli.py
+1
-2
meetslut/config.py
meetslut/config.py
+5
-5
meetslut/webparser.py
meetslut/webparser.py
+2
-2
pyproject.toml
pyproject.toml
+1
-1
requirements.txt
requirements.txt
+3
-0
test.py
test.py
+45
-0
未找到文件。
meetslut/cli.py
浏览文件 @
8e572721
...
...
@@ -2,8 +2,7 @@
The Command Line Interface (CLI) for the downloader
"""
import
os
,
argparse
,
logging
,
json
import
sys
sys
.
path
.
append
(
'D:\workspace\meetslut'
)
from
meetslut.webparser
import
ParserFactory
from
meetslut.download
import
download
...
...
meetslut/config.py
浏览文件 @
8e572721
...
...
@@ -7,11 +7,11 @@ GET_CFG = {
'headers'
:
{
"User-Agent"
:
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.183 Safari/537.36"
},
#
'proxies': None,
'proxies'
:
{
'http'
:
'socks5h://127.0.0.1:2801'
,
'https'
:
'socks5h://127.0.0.1:2801'
},
'proxies'
:
None
,
#
'proxies': {
#
'http': 'socks5h://127.0.0.1:2801',
#
'https': 'socks5h://127.0.0.1:2801'
#
},
'timeout'
:
5
}
"""
...
...
meetslut/webparser.py
浏览文件 @
8e572721
import
sys
sys
.
path
.
append
(
'D:\workspace\meetslut'
)
#
import sys
#
sys.path.append('D:\workspace\meetslut')
from
typing
import
Union
,
Optional
from
abc
import
ABCMeta
,
abstractmethod
...
...
pyproject.toml
浏览文件 @
8e572721
[build-system]
requires
=
[
"setuptools>=42"
,
"beautifulsoup4"
]
requires
=
[
"setuptools>=42"
,
"beautifulsoup4"
,
"lxml"
]
build-backend
=
"setuptools.build_meta"
\ No newline at end of file
requirements.txt
0 → 100644
浏览文件 @
8e572721
requests
lxml
beautifulsoup4
\ No newline at end of file
test.py
0 → 100644
浏览文件 @
8e572721
# import sys
# sys.path.append('D:\workspace\meetslut')
from
datetime
import
datetime
import
unittest
from
meetslut.config
import
GET_CFG
from
meetslut.download
import
amend_suffix
from
meetslut.webparser
import
ParserFactory
from
meetslut.download
import
download
class
Tester
(
unittest
.
TestCase
):
# def setUp(self):
# print(f'Test start @: {datetime.now().strftime("%Y-%m-%d, %H:%M:%S")}')
# def tearDown(self):
# print(f'Test end @: {datetime.now().strftime("%Y-%m-%d, %H:%M:%S")}')
def
test_amend_suffix
(
self
):
self
.
assertEqual
(
amend_suffix
(
'.gif'
),
'.gif'
,
'error'
)
self
.
assertEqual
(
amend_suffix
(
'.jiff'
),
'.jpg'
,
'error'
)
def
test_factory
(
self
):
for
url
in
[
'https://caitlin.top/home'
,
'https://www.99zipai.com/selfies'
,
'https://motherless.com/'
]:
p
=
ParserFactory
.
create
(
url
)
self
.
assertTrue
(
p
)
@
unittest
.
skipIf
(
GET_CFG
[
'proxies'
]
is
None
,
"Skiped: the proxy is necessary."
)
def
test_bool_value
(
self
):
self
.
assertTrue
(
self
.
test_class
.
is_string
(
"hello world!"
))
if
__name__
==
'__main__'
:
# build test
suite
=
unittest
.
TestSuite
()
suite
.
addTest
(
Tester
(
'test_amend_suffix'
))
suite
.
addTest
(
Tester
(
'test_factory'
))
# execute test
runner
=
unittest
.
TextTestRunner
()
runner
.
run
(
suite
)
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录