Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
D
DAN
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Container Registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Automatic Text Recognition
DAN
Merge requests
!28
Add test for format command
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Add test for format command
unit-tests-for-format
into
main
Overview
0
Commits
1
Pipelines
0
Changes
1
Merged
Yoann Schneider
requested to merge
unit-tests-for-format
into
main
2 years ago
Overview
0
Commits
1
Pipelines
0
Changes
1
Expand
Closes
#18 (closed)
Extract command already had tests
0
0
Merge request reports
Compare
main
main (base)
and
latest version
latest version
944f27ba
1 commit,
2 years ago
1 file
+
36
−
0
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
tests/test_format.py
0 → 100644
+
36
−
0
Options
# -*- coding: utf-8 -*-
from
pathlib
import
Path
import
pytest
from
dan.datasets.format.atr
import
ATRDatasetFormatter
,
remove_spaces
@pytest.mark.parametrize
(
"
text,trimmed
"
,
(
(
"
no_spaces
"
,
"
no_spaces
"
),
(
"
beginning
"
,
"
beginning
"
),
(
"
ending
"
,
"
ending
"
),
(
"
both
"
,
"
both
"
),
(
"
consecutive
"
,
"
consecutive
"
),
(
"
\t
tab
"
,
"
tab
"
),
),
)
def
test_remove_spaces
(
text
,
trimmed
):
assert
remove_spaces
(
text
)
==
trimmed
@pytest.mark.parametrize
(
"
image_format, expected_format
"
,
(
(
"
.png
"
,
"
png
"
),
(
"
png
"
,
"
png
"
),
),
)
def
test_image_format_parsing
(
image_format
,
expected_format
):
formatter
=
ATRDatasetFormatter
(
dataset
=
Path
(
"
my_dataset
"
),
image_format
=
image_format
,
remove_spaces
=
True
)
assert
formatter
.
image_format
==
expected_format
Loading