Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
SaQC
Manage
Activity
Members
Labels
Plan
Issues
35
Issue boards
Milestones
Wiki
Code
Merge requests
7
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
rdm-software
SaQC
Commits
ec6d77d8
Commit
ec6d77d8
authored
2 years ago
by
Bert Palm
🎇
Browse files
Options
Downloads
Patches
Plain Diff
FIX: use `with pytest.raises` instead of `pytest.xfail`
parent
8ab6b492
No related branches found
Branches containing commit
No related tags found
1 merge request
!462
More tests
Pipeline
#93444
passed with stage
in 2 minutes and 3 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/core/test_flags.py
+19
-14
19 additions, 14 deletions
tests/core/test_flags.py
with
19 additions
and
14 deletions
tests/core/test_flags.py
+
19
−
14
View file @
ec6d77d8
...
...
@@ -313,20 +313,7 @@ def test_to_frame(data: Union[pd.DataFrame, dios.DictOfSeries, Dict[str, pd.Seri
@pytest.mark.parametrize
(
"
columns
"
,
[
# ok
[
"
x
"
,
"
y
"
],
pd
.
Index
([
"
x
"
,
"
y
"
]),
# expect to fail
pytest
.
param
(
pd
.
Index
([
"
x
"
,
"
x
"
]),
marks
=
pytest
.
mark
.
xfail
(
reason
=
"
not unique
"
)
),
pytest
.
param
(
pd
.
Index
([
"
x
"
]),
marks
=
pytest
.
mark
.
xfail
(
reason
=
"
wrong length
"
)),
pytest
.
param
(
pd
.
Index
([
"
x
"
,
"
x
"
,
"
x
"
]),
marks
=
pytest
.
mark
.
xfail
(
reason
=
"
wrong length
"
),
),
],
[[
"
x
"
,
"
y
"
],
pd
.
Index
([
"
x
"
,
"
y
"
])],
)
def
test_columns_setter
(
columns
):
flags
=
Flags
(
...
...
@@ -335,3 +322,21 @@ def test_columns_setter(columns):
flags
.
columns
=
columns
for
c
in
columns
:
assert
c
in
flags
.
columns
@pytest.mark.parametrize
(
"
columns,err
"
,
[
(
"
foooo
"
,
TypeError
),
# cannot cast to Index
(
pd
.
Index
([
"
x
"
,
"
x
"
]),
TypeError
),
# duplicates
(
pd
.
Index
([
1
,
2
]),
TypeError
),
# not string
(
pd
.
Index
([
"
x
"
,
"
y
"
,
"
z
"
]),
ValueError
),
# wrong length
(
pd
.
Index
([
"
x
"
]),
ValueError
),
# wrong length
],
)
def
test_columns_setter_raises
(
columns
,
err
):
flags
=
Flags
(
{
"
a
"
:
pd
.
Series
([
1
,
2
],
dtype
=
float
),
"
b
"
:
pd
.
Series
([
1
,
2
],
dtype
=
float
)}
)
with
pytest
.
raises
(
err
):
flags
.
columns
=
columns
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment