Skip to content

Commit

Permalink
feat: Updated to individual unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
iamMoid committed Jan 22, 2022
1 parent 78c86fe commit 11d8bcd
Showing 1 changed file with 19 additions and 10 deletions.
29 changes: 19 additions & 10 deletions tests/test_scatterplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,30 +27,39 @@ def test_scatterplot():
raise TypeError(
"sample_data should be of a pandas dataframe of type: 'pandas.core.frame.DataFrame'"
)

# check if the x column is mapped to x-axis

def test_enc_x_shorthand:
"""check if the x column is mapped to x-axis"""
assert scatter.encoding.x.shorthand == 'year', 'x should be mapped to the x-axis'
# check if the y column is mapped to y-axis
def test_enc_y_shorthand:
"""check if the y column is mapped to y-axis"""
assert scatter.encoding.y.shorthand == 'no_of_cars', 'y should be mapped to the y-axis'
# check if the color scheme is set to magma
def test_enc_color_scheme:
"""check if the color scheme is set to magma"""
assert scatter.encoding.color.scale.scheme == 'magma', 'color scale scheme should be magma'
# check if the mark type is point
def test_mark_type:
"""check if the mark type is point"""
assert scatter.mark.type == 'point', 'mark type should be a point'
# check if the mark opacity is 0.5
def test_mark_opacity:
"""check if the mark opacity is 0.5"""
assert scatter.mark.opacity == 0.5, 'mark opacity should be 0.5'
# check if the mark size is 50
def test_mark_size:
"""check if the mark size is 50"""
assert scatter.mark.size == 50, 'mark size should be 50'
# check if the x axis does not start from zero
def test_enc_x_scale:
"""check if the x axis does not start from zero"""
assert scatter.encoding.x.scale.zero == False, 'x-axis should not start at 0'
# check if the y axis does not start from zero
def test_enc_y_scale:
"""check if the y axis does not start from zero"""
assert scatter.encoding.y.scale.zero == False, 'y-axis should not start at 0'
# check if the title is correctly updated based on field names
def test_plot_title:
"""check if the title is correctly updated based on field names"""
assert scatter.title == 'Year vs No Of Cars by Brand', 'title should be "Year vs No of Cars by Brand"'

0 comments on commit 11d8bcd

Please sign in to comment.