-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_line_finder.py
More file actions
33 lines (25 loc) · 1.04 KB
/
test_line_finder.py
File metadata and controls
33 lines (25 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import unittest
import pandas as pd
from line_finder import LineFinder # Adjust the import based on your actual module structure
class TestLineFinder(unittest.TestCase):
def test_get_the_lines(self):
# Create a sample DataFrame for testing
sample_data = pd.DataFrame({
'Line': ['720', '150'],
'Stop name': ['Zurich Wollishofen', 'Allaman']
})
# Initialize an instance of LineFinder
line_finder = LineFinder()
# Override the data attribute of the instance for testing
line_finder.data = sample_data
# Call the function to be tested
result1 = line_finder.get_the_lines('Zurich Wollishofen')
result2 =line_finder.get_the_lines('Allaman')
# Define the expected result
expected_result1 = {'720'}
expected_result2 ={'150'}
# Check if the result matches the expected output
self.assertEqual(result1, expected_result1)
self.assertEqual(result2, expected_result2)
if __name__ == '__main__':
unittest.main()