40 lines
1.2 KiB
Python
40 lines
1.2 KiB
Python
import unittest
|
|
|
|
import pandas as pd
|
|
from energy_data_project import get_larger_cities_north_of_city, get_cities_beyond_latitude
|
|
|
|
# main.py # python main.py
|
|
# pip install -e /pfad/zum/modul
|
|
# datei1.py
|
|
# test_datei1.py
|
|
|
|
|
|
# ein modul erstellen und darin datei1.py auslagern
|
|
# datei1.py
|
|
# test_datei1.py
|
|
|
|
class MyTestCase(unittest.TestCase):
|
|
def __init__(self, *args, **kwargs):
|
|
super().__init__(*args, **kwargs)
|
|
self.world_cities = pd.read_excel("data/worldcities.xlsx")
|
|
|
|
def setUp(self):
|
|
print("Loading data")
|
|
|
|
def tearDown(self):
|
|
print("After test")
|
|
|
|
def test_get_larger_cities_north_of_city(self):
|
|
self.assertEqual(True, False) # add assertion here
|
|
cities_north = get_larger_cities_north_of_city(self.world_cities, "Berlin")
|
|
assert cities_north.iloc[0, 0], f"Error {cities_north.iloc[0, 0]} "
|
|
|
|
def test_something(self):
|
|
self.assertEqual(True, False) # add assertion here
|
|
cities_north = get_larger_cities_north_of_city(self.world_cities, "Berlin")
|
|
assert cities_north.iloc[0, 0] == "Moscow", f"Error {cities_north.iloc[0, 0]} "
|
|
|
|
|
|
if __name__ == '__main__':
|
|
unittest.main()
|