def __init__(self, type_of_car: str, model: str, name: str, **kwargs): """Constructor""" Car.__init__(self, type_of_car, model, name, kwargs['amount_of_passengers'], kwargs['amount_of_wheels']) Electricity.__init__(self, kwargs['voltage'], kwargs['amperage'])
class ElectricityTest(unittest.TestCase): # Setup method def setUp(self): # Initiate class self.thisElec = Electricity() # Test for the list to csv def testReadAll(self): # check for the right execution self.assertTrue(self.thisElec.readAll())
class ElectricityTest(unittest.TestCase): # Setup method def setUp(self): # Initiate class self.thisElec = Electricity() # Test for the list to csv def testConvrtLstToCSV(self): # Define a list testList = ["a", "b", "c"] # Pass the list testCSV = self.thisElec.convrtLstToCSV(testList) # check for the right execution self.assertEqual(testCSV, "a,b,c")
def __init__(self, *args, **kwargs): self.power = "" # get data and merge on 'tds' if "Electricity" in args: self.power = "Electricity" self.data = Electricity().get_data(**kwargs) else: self.power = "Water" self.data = Water().get_data(**kwargs) self.coords = Coords().get_all_data() # cleanup the data self.merge_coords() self.add_year_column() self.set_dtypes() # compute df of mean consumption by (tds x year) self.tds_by_year = None self.get_by_year_data() # add other pre-computed dataframes here # ... self.tds_sum_year = None self.get_aggregate_data()
def setUp(self): # Initiate class self.thisElec = Electricity()
def get_electricity_counter(counter_id): elect = Electricity() return elect.get_counter(counter_id)
def get_electricity(): elect = Electricity() return elect.get_all()