Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
RSE 23 Group Assignment Shervud Pitawanik Franz
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
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
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Niklas Franz
RSE 23 Group Assignment Shervud Pitawanik Franz
Commits
5946f08f
Commit
5946f08f
authored
1 year ago
by
Sortofamudkip
Browse files
Options
Downloads
Patches
Plain Diff
added tests for new code (100% coverage)
parent
c48fe587
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
.coverage
+0
-0
0 additions, 0 deletions
.coverage
src/test_dataset.py
+38
-1
38 additions, 1 deletion
src/test_dataset.py
with
38 additions
and
1 deletion
.coverage
+
0
−
0
View file @
5946f08f
No preview for this file type
This diff is collapsed.
Click to expand it.
src/test_dataset.py
+
38
−
1
View file @
5946f08f
...
...
@@ -145,7 +145,10 @@ def test_catch_colname_not_in_df(the_dataset: Dataset):
the_dataset
.
get_category_counts
(
"
GAAAD_T
"
)
with
pytest
.
raises
(
KeyError
):
the_dataset
.
get_sorted_column
(
"
GAAAD_T
"
)
with
pytest
.
raises
(
KeyError
):
the_dataset
.
get_column_mean
(
"
GAAAD_T
"
)
with
pytest
.
raises
(
KeyError
):
the_dataset
.
filtered_rows
(
"
GAAAD_T
"
,
5
)
with
pytest
.
raises
(
KeyError
):
the_dataset
.
treat_outliers
(
the_dataset
.
get_dataframe
(),
"
GAAAD_T
"
)
...
...
@@ -161,3 +164,37 @@ def test_catch_colname_not_string(the_dataset: Dataset):
the_dataset
.
get_unique_column_values
(
True
)
with
pytest
.
raises
(
ValueError
):
the_dataset
.
treat_outliers
(
the_dataset
.
get_dataframe
(),
True
)
with
pytest
.
raises
(
ValueError
):
the_dataset
.
get_column_mean
(
True
)
with
pytest
.
raises
(
ValueError
):
the_dataset
.
filtered_rows
(
True
,
"
7
"
)
def
test_get_column_count
(
the_dataset
:
Dataset
):
"""
Tests that get_column_count works correctly.
"""
assert
the_dataset
.
get_column_count
()
==
20
def
test_get_row_count
(
the_dataset
:
Dataset
):
"""
Tests that get_row_count works correctly.
"""
assert
the_dataset
.
get_row_count
()
==
12838
def
test_get_column_mean
(
the_dataset
:
Dataset
):
"""
Tests that get_column_mean works correctly.
"""
assert
the_dataset
.
get_column_mean
(
"
GAD_T
"
)
==
pytest
.
approx
(
5.17557
)
def
test_filtered_rows
(
the_dataset
:
Dataset
):
"""
Tests that filtered_rows works correctly.
"""
assert
len
(
the_dataset
.
filtered_rows
(
"
GAD_T
"
,
5.0
))
==
976
assert
len
(
the_dataset
.
filtered_rows
(
"
SWL_T
"
,
0.0
))
==
0
assert
len
(
the_dataset
.
filtered_rows
(
"
whyplay
"
,
"
improving
"
))
==
4661
def
test_get_columns
(
the_dataset
:
Dataset
):
"""
Tests that get_columns works correctly.
"""
columns
=
the_dataset
.
get_columns
()
assert
"
SWL_T
"
in
columns
assert
"
GAD_T
"
in
columns
assert
"
whyplay
"
in
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