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
4c9ca32e
Commit
4c9ca32e
authored
1 year ago
by
Sortofamudkip
Browse files
Options
Downloads
Patches
Plain Diff
test_dataset documentation
parent
e622b7d1
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/test_dataset.py
+7
-1
7 additions, 1 deletion
src/test_dataset.py
with
7 additions
and
1 deletion
src/test_dataset.py
+
7
−
1
View file @
4c9ca32e
...
...
@@ -11,22 +11,25 @@ this_file_dir = Path(__file__).parent
@pytest.fixture
def
the_dataset
():
def
the_dataset
()
->
Dataset
:
dataset
=
Dataset
(
this_file_dir
/
"
../data/GamingStudy_data.csv
"
)
return
dataset
def
test_load_Dataset_class
():
"""
Tests if the dataset is successfully loaded.
"""
dataset
=
Dataset
(
this_file_dir
/
"
../data/GamingStudy_data.csv
"
)
assert
type
(
dataset
)
==
Dataset
assert
type
(
dataset
.
dataframe
)
==
pd
.
DataFrame
def
test_get_dataframe
(
the_dataset
:
Dataset
):
"""
Tests Dataset.get_dataframe().
"""
assert
type
(
the_dataset
.
get_dataframe
())
==
pd
.
DataFrame
def
test_combined_anxiety_score
(
the_dataset
:
Dataset
):
"""
Tests Dataset.get_combined_anxiety_score().
"""
dataframe
=
the_dataset
.
get_dataframe
()
anxiety_scores
=
the_dataset
.
get_combined_anxiety_score
(
dataframe
)
assert
anxiety_scores
.
dtype
==
float
...
...
@@ -35,12 +38,14 @@ def test_combined_anxiety_score(the_dataset: Dataset):
def
test_get_is_narcissist_col
(
the_dataset
:
Dataset
):
"""
Tests Dataset.get_is_narcissist_col().
"""
dataframe
=
the_dataset
.
get_dataframe
()
is_narcissist_row
=
the_dataset
.
get_is_narcissist_col
(
dataframe
)
assert
is_narcissist_row
.
dtype
==
bool
def
test_preprocessed_dataframe
(
the_dataset
:
Dataset
):
"""
Tests that the dataframe is preprocessed correctly.
"""
dataframe
=
the_dataset
.
get_dataframe
()
columns_set
=
set
(
dataframe
.
columns
)
assert
"
League
"
not
in
columns_set
...
...
@@ -49,5 +54,6 @@ def test_preprocessed_dataframe(the_dataset: Dataset):
def
test_get_sorted_columns
(
the_dataset
:
Dataset
):
"""
Tests Dataset.get_sorted_column().
"""
sorted_GAD1
=
the_dataset
.
get_sorted_column
(
"
GAD1
"
)
assert
sorted_GAD1
.
iloc
[
0
]
<=
sorted_GAD1
.
iloc
[
-
1
]
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