Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
pdf-miner
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Qin Kaijie
pdf-miner
Commits
65734029
Commit
65734029
authored
Sep 12, 2024
by
quyuan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: add magic-pdf-dev case
parent
f9df92aa
Changes
9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
1525 additions
and
7 deletions
+1525
-7
cli.yml
.github/workflows/cli.yml
+2
-1
__init__.cpython-39.pyc
magic_pdf/__pycache__/__init__.cpython-39.pyc
+0
-0
__init__.cpython-39.pyc
magic_pdf/libs/__pycache__/__init__.cpython-39.pyc
+0
-0
version.cpython-39.pyc
magic_pdf/libs/__pycache__/version.cpython-39.pyc
+0
-0
clean_covrage.py
tests/clean_covrage.py
+24
-0
get_coverage.py
tests/get_coverage.py
+1
-1
test_model.json
tests/test_cli/pdf_dev/test_model.json
+1472
-0
test_cli_sdk.py
tests/test_cli/test_cli_sdk.py
+26
-5
test_tablemaster.cpython-39-pytest-7.4.0.pyc
.../__pycache__/test_tablemaster.cpython-39-pytest-7.4.0.pyc
+0
-0
No files found.
.github/workflows/cli.yml
View file @
65734029
...
...
@@ -37,7 +37,8 @@ jobs:
run
:
|
echo $GITHUB_WORKSPACE && sh tests/retry_env.sh
-
name
:
unit test
run
:
|
run
:
|
cd $GITHUB_WORKSPACE && python tests/clean_coverage.py
cd $GITHUB_WORKSPACE && export PYTHONPATH=. && coverage run -m pytest tests/test_unit.py --cov=magic_pdf/ --cov-report term-missing --cov-report html
cd $GITHUB_WORKSPACE && python tests/get_coverage.py
-
name
:
cli test
...
...
magic_pdf/__pycache__/__init__.cpython-39.pyc
0 → 100644
View file @
65734029
File added
magic_pdf/libs/__pycache__/__init__.cpython-39.pyc
0 → 100644
View file @
65734029
File added
magic_pdf/libs/__pycache__/version.cpython-39.pyc
0 → 100644
View file @
65734029
File added
tests/clean_covrage.py
0 → 100644
View file @
65734029
"""
clean coverage
"""
import
os
import
shutil
def
delete_file
(
path
):
"""delete file."""
if
not
os
.
path
.
exists
(
path
):
if
os
.
path
.
isfile
(
path
):
try
:
os
.
remove
(
path
)
print
(
f
"File '{path}' deleted."
)
except
TypeError
as
e
:
print
(
f
"Error deleting file '{path}': {e}"
)
elif
os
.
path
.
isdir
(
path
):
try
:
shutil
.
rmtree
(
path
)
print
(
f
"Directory '{path}' and its contents deleted."
)
except
TypeError
as
e
:
print
(
f
"Error deleting directory '{path}': {e}"
)
if
__name__
==
"__main__"
:
delete_file
(
"htmlcov"
)
\ No newline at end of file
tests/get_coverage.py
View file @
65734029
...
...
@@ -2,7 +2,7 @@
get cov
"""
from
bs4
import
BeautifulSoup
import
shutil
def
get_covrage
():
"""get covrage"""
# 发送请求获取网页内容
...
...
tests/test_cli/pdf_dev/test_model.json
0 → 100644
View file @
65734029
This diff is collapsed.
Click to expand it.
tests/test_cli/test_cli_sdk.py
View file @
65734029
...
...
@@ -182,7 +182,7 @@ class TestCli:
def
test_pdf_dev_cli_local_jsonl_txt
(
self
):
"""magic_pdf_dev cli local txt."""
jsonl_path
=
os
.
path
.
join
(
pdf_dev_path
,
'line1.jsonl'
)
cmd
=
'magic-pdf-dev --jsonl
%
s -
m
%
s'
%
(
jsonl_path
,
"txt"
)
cmd
=
'magic-pdf-dev --jsonl
%
s -
-method
%
s'
%
(
jsonl_path
,
"txt"
)
logging
.
info
(
cmd
)
os
.
system
(
cmd
)
...
...
@@ -191,7 +191,7 @@ class TestCli:
def
test_pdf_dev_cli_local_jsonl_ocr
(
self
):
"""magic_pdf_dev cli local ocr."""
jsonl_path
=
os
.
path
.
join
(
pdf_dev_path
,
'line1.jsonl'
)
cmd
=
'magic-pdf-dev --jsonl
%
s -
m
%
s'
%
(
jsonl_path
,
'ocr'
)
cmd
=
'magic-pdf-dev --jsonl
%
s -
-method
%
s'
%
(
jsonl_path
,
'ocr'
)
logging
.
info
(
cmd
)
os
.
system
(
cmd
)
...
...
@@ -199,7 +199,7 @@ class TestCli:
def
test_pdf_dev_cli_local_jsonl_auto
(
self
):
"""magic_pdf_dev cli local auto."""
jsonl_path
=
os
.
path
.
join
(
pdf_dev_path
,
'line1.jsonl'
)
cmd
=
'magic-pdf-dev --jsonl
%
s -
m
%
s'
%
(
jsonl_path
,
'auto'
)
cmd
=
'magic-pdf-dev --jsonl
%
s -
-method
%
s'
%
(
jsonl_path
,
'auto'
)
logging
.
info
(
cmd
)
os
.
system
(
cmd
)
...
...
@@ -207,7 +207,7 @@ class TestCli:
def
test_pdf_dev_cli_s3_jsonl_txt
(
self
):
"""magic_pdf_dev cli s3 txt."""
jsonl_path
=
os
.
path
.
join
(
pdf_dev_path
,
'line1.jsonl'
)
cmd
=
'magic-pdf-dev --jsonl
%
s -
m
%
s'
%
(
jsonl_path
,
"txt"
)
cmd
=
'magic-pdf-dev --jsonl
%
s -
-method
%
s'
%
(
jsonl_path
,
"txt"
)
logging
.
info
(
cmd
)
os
.
system
(
cmd
)
...
...
@@ -216,7 +216,7 @@ class TestCli:
def
test_pdf_dev_cli_s3_jsonl_ocr
(
self
):
"""magic_pdf_dev cli s3 ocr."""
jsonl_path
=
os
.
path
.
join
(
pdf_dev_path
,
'line1.jsonl'
)
cmd
=
'magic-pdf-dev --jsonl
%
s -
m
%
s'
%
(
jsonl_path
,
'ocr'
)
cmd
=
'magic-pdf-dev --jsonl
%
s -
-method
%
s'
%
(
jsonl_path
,
'ocr'
)
logging
.
info
(
cmd
)
os
.
system
(
cmd
)
...
...
@@ -229,5 +229,26 @@ class TestCli:
os
.
system
(
cmd
)
@
pytest
.
mark
.
P1
def
test_pdf_dev_cli_pdf_json_auto
(
self
):
"""magic_pdf_dev cli pdf+json auto."""
json_path
=
os
.
path
.
join
(
pdf_dev_path
,
'test_model.json'
)
pdf_path
=
os
.
path
.
join
(
pdf_dev_path
,
'pdf'
,
'research_report_1f978cd81fb7260c8f7644039ec2c054.pdf'
)
cmd
=
'magic-pdf-dev --pdf
%
s --json
%
s --method
%
s'
%
(
pdf_path
,
json_path
,
'auto'
)
logging
.
info
(
cmd
)
os
.
system
(
cmd
)
@
pytest
.
mark
.
P1
def
test_pdf_dev_cli_pdf_json_ocr
(
self
):
"""magic_pdf_dev cli pdf+json ocr."""
json_path
=
os
.
path
.
join
(
pdf_dev_path
,
'test_model.json'
)
pdf_path
=
os
.
path
.
join
(
pdf_dev_path
,
'pdf'
,
'research_report_1f978cd81fb7260c8f7644039ec2c054.pdf'
)
cmd
=
'magic-pdf-dev --pdf
%
s --json
%
s --method
%
s'
%
(
pdf_path
,
json_path
,
'auto'
)
logging
.
info
(
cmd
)
os
.
system
(
cmd
)
if
__name__
==
'__main__'
:
pytest
.
main
()
tests/unittest/test_table/__pycache__/test_tablemaster.cpython-39-pytest-7.4.0.pyc
0 → 100644
View file @
65734029
File added
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment