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
0692666b
Commit
0692666b
authored
1 year ago
by
Sortofamudkip
Browse files
Options
Downloads
Patches
Plain Diff
plotting param tests
parent
cda0fa31
No related branches found
No related tags found
1 merge request
!12
Merge "Write tests" branch into master
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/test_plotter.py
+37
-0
37 additions, 0 deletions
src/test_plotter.py
with
37 additions
and
0 deletions
src/test_plotter.py
+
37
−
0
View file @
0692666b
...
...
@@ -4,12 +4,49 @@ from Dataset import Dataset
from
Plotter
import
Plotter
import
pandas
as
pd
import
pytest
this_file_dir
=
Path
(
__file__
).
parent
@pytest.fixture
def
the_plotter
()
->
Dataset
:
dataset
=
Dataset
(
str
(
this_file_dir
/
"
../data/GamingStudy_data.csv
"
))
plotter
=
Plotter
(
dataset
)
return
plotter
def
test_load_plotter
():
"""
Tests that the Plotter class can be loaded.
"""
dataset
=
Dataset
(
str
(
this_file_dir
/
"
../data/GamingStudy_data.csv
"
))
plotter
=
Plotter
(
dataset
)
assert
type
(
plotter
.
df
)
==
pd
.
DataFrame
assert
type
(
plotter
.
ds
)
==
Dataset
def
test_catch_colname_not_in_df
(
the_plotter
:
Plotter
):
"""
Tests that functions that take colname correctly
catch colnames not in dataset.
"""
with
pytest
.
raises
(
KeyError
):
the_plotter
.
distribution_plot
(
"
GAAAD_T
"
)
def
test_catch_target_not_string
(
the_plotter
:
Plotter
):
"""
Tests that functions that take target correctly
catch non strings.
"""
with
pytest
.
raises
(
ValueError
):
the_plotter
.
distribution_plot
(
True
)
@pytest.mark.parametrize
(
"
param
"
,
[
True
,
None
,
"
notdict
"
,
6.4
,
pd
,
(
1
,),
Dataset
],
)
def
test_catch_styling_params_not_dict
(
the_plotter
:
Plotter
,
param
):
"""
Tests that functions that take styling_params correctly
catch non dictionaries.
"""
with
pytest
.
raises
(
ValueError
):
the_plotter
.
distribution_plot
(
"
GAD_T
"
,
param
)
the_plotter
.
plot_categorical_bar_chart
(
"
GAD_T
"
,
"
GAD_T
"
,
param
)
the_plotter
.
plot_categorical_histplot
(
"
GAD_T
"
,
"
GAD_T
"
,
param
)
the_plotter
.
plot_scatterplot
(
"
GAD_T
"
,
"
GAD_T
"
,
param
)
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