Rename tests and place in dedicated folder
This commit is contained in:
1 parent
47ffe088ff
commit
1f08fa502b
2 files changed
No files matched your search
@@ -0,0 +1,25 @@
|
||||
import pytest
|
||||
import pandas as pd
|
||||
|
||||
import lottery_predictor.analyze as analyze
|
||||
|
||||
|
||||
def test_load_dataframe() -> None:
|
||||
assert int(analyze.load_dataframe(table_name='PowerballDraw').count()['draw_date']) >= 1324
|
||||
assert int(analyze.load_dataframe(table_name='MegaMillionsDraw').count()['draw_date']) >= 95
|
||||
with pytest.raises(ValueError):
|
||||
analyze.load_dataframe(table_name='SomNonExistentTableName')
|
||||
|
||||
|
||||
def test_least_and_most_common_number() -> None:
|
||||
pb_df = analyze.load_dataframe(table_name='PowerballDraw')
|
||||
mm_df = analyze.load_dataframe(table_name='MegaMillionsDraw')
|
||||
assert len(analyze.get_most_common_number(pb_df, top=5)) == 5
|
||||
assert len(analyze.get_least_common_number(pb_df, bottom=5)) == 5
|
||||
assert len(analyze.get_most_common_number(mm_df, top=5)) == 5
|
||||
assert len(analyze.get_least_common_number(mm_df, bottom=5)) == 5
|
||||
|
||||
assert len(analyze.get_most_common_number(pb_df, columns=['powerball'], top=1)) == 1
|
||||
assert len(analyze.get_least_common_number(pb_df, columns=['powerball'], bottom=1)) == 1
|
||||
assert len(analyze.get_most_common_number(mm_df, columns=['mega_ball'], top=1)) == 1
|
||||
assert len(analyze.get_least_common_number(mm_df, columns=['mega_ball'], bottom=1)) == 1
|
||||
@@ -0,0 +1,25 @@
|
||||
import datetime
|
||||
import pytest
|
||||
|
||||
import lottery_predictor.collect as collect
|
||||
|
||||
|
||||
def test_get_record_count() -> None:
|
||||
assert isinstance(collect.get_record_count(table_name='PowerballDraw'), int)
|
||||
assert isinstance(collect.get_record_count(table_name='MegaMillionsDraw'), int)
|
||||
with pytest.raises(ValueError):
|
||||
collect.get_record_count(table_name='SomeNonExistentTable')
|
||||
|
||||
|
||||
def test_get_recent_draw_date() -> None:
|
||||
assert isinstance(collect.get_recent_draw_date(table_name='PowerballDraw'), datetime.date)
|
||||
assert isinstance(collect.get_recent_draw_date(table_name='MegaMillionsDraw'), datetime.date)
|
||||
with pytest.raises(ValueError):
|
||||
collect.get_recent_draw_date(table_name='SomeNonExistentTable')
|
||||
|
||||
|
||||
def test_get_missing_records() -> None:
|
||||
assert isinstance(collect.get_missing_records(table_name='PowerballDraw'), int)
|
||||
assert isinstance(collect.get_missing_records(table_name='MegaMillionsDraw'), int)
|
||||
with pytest.raises(ValueError):
|
||||
collect.get_missing_records(table_name='SomeNonExistentTable')
|
||||
Reference in new issue
Block a user