Skip to content

Commit

Permalink
docs: add documentation for test function
Browse files Browse the repository at this point in the history
  • Loading branch information
ciciecho-ds committed Jan 21, 2022
1 parent cebdce0 commit 29c877a
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions tests/test_plot_price.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,18 @@
import altair as alt
import pandas as pd

helper_data = pd.DataFrame({
'Name': np.array(['Bitcoin', 'Bitcoin', 'Bitcoin', 'Bitcoin' ,'Bitcoin']),
'Date': np.array(['2021-01-01', '2021-01-02', '2021-01-03', '2021-01-04', '2021-01-05']),
'Close': np.array([29374.15189, 32127.26794, 32782.02447, 31971.91352, 33992.42934])
})
def test_plot_price(helper_plot):
"""
Test the plot_price function returns a plot with the correct attributes.
"""
helper_data = pd.DataFrame({
'Name': np.array(['Bitcoin', 'Bitcoin', 'Bitcoin', 'Bitcoin' ,'Bitcoin']),
'Date': np.array(['2021-01-01', '2021-01-02', '2021-01-03', '2021-01-04', '2021-01-05']),
'Close': np.array([29374.15189, 32127.26794, 32782.02447, 31971.91352, 33992.42934])
})

helper_plot = CryptoCurrencyEDA.plot_price(helper_data)
helper_plot = CryptoCurrencyEDA.plot_price(helper_data)

def test_plot_price():
assert helper_plot.encoding.x.field == 'Date', 'x_axis should be mapped to the x axis'
assert helper_plot.encoding.y.field == 'Close', 'y_axis should be mapped to the y axis'
assert helper_plot.mark == 'line', 'mark should be a line'
Expand Down

0 comments on commit 29c877a

Please sign in to comment.