-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnote_maker_test.py
More file actions
37 lines (26 loc) · 1.46 KB
/
note_maker_test.py
File metadata and controls
37 lines (26 loc) · 1.46 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
34
35
36
37
import unittest
from note_maker import *
example_headers = "timestamp, name, religion, sham, ba, lu, lu, isCute, isTall, isPlayingD&D".split(", ")
name_column_in_csv = 1
first_flag_column = 7
row_with_no_categories = "0, Mr. Bean, jewish, bam, ba, shu, shu, False, false, FALSE".split(", ")
row_with_two_categories = "0, Vin Diesel, jewish, bam, ba, shu, shu, False, true, TRUE".split(", ")
inspected_row_converter = RowConverter(example_headers, name_column_in_csv, first_flag_column)
def parse_flags_of_example_row(example_row):
return inspected_row_converter.parse_relevant_categories_from_line(example_row)[1]
class MyTestCase(unittest.TestCase):
def test_applicantNameIsAlwaysReturnedAsFirstElementOfPair(self):
self.assertEqual(
inspected_row_converter.parse_relevant_categories_from_line(row_with_no_categories)[0],
row_with_no_categories[name_column_in_csv])
self.assertEqual(
inspected_row_converter.parse_relevant_categories_from_line(row_with_two_categories)[0],
row_with_two_categories[name_column_in_csv])
def test_whenApplicantHasNoRelevantCategoriesInLine_thenEmptyListIsReturned(self):
self.assertEqual(
parse_flags_of_example_row(row_with_no_categories), [])
def test_whenApplicantHasTwoCategories_thenBothAreReturned(self):
self.assertEqual(
len(parse_flags_of_example_row(row_with_two_categories)), 2)
if __name__ == '__main__':
unittest.main()