I'm learning how to use unittest in python. I have a class that receives a pandas dataframe in it's init method.
class GenericClass:
def __init__(self, data):
if not (isinstance(data, pd.DataFrame) or isinstance(data, pd.Series)):
raise ValueError(f'The object {data} must be a pd.DataFrame or a pd.Series')
self.data = data
I've created a file called test.py
. And in this file i'll test the methods of GenericClass
.
import unittest
from file import GenericClass
class TestHistan(unittest.TestCase):
def test_input(self):
# no idea on how to implement this
My question is, how do i make a test function that tests the inputs passed on the init method of the generic Class?