예제 #1
0
 def test_1(self):
     result = {
         'David': [['5', '14:02', '15:46', 'F505']],
         'Fran': [],
         'Marco': [['1', '09:02', '10:17', 'R100'],
                   ['3', '10:58', '12:05', 'R205']]
     }
     file = 'input.txt'
     self.assertEqual(file_to_dict(file), result)
예제 #2
0
 def test_1(self):
     result = [
         'David: 104 minutes in 1 day', 'Marco: 142 minutes in 2 days',
         'Fran: 0 minutes '
     ]
     file = 'input.txt'
     students_presence_dict = file_to_dict(file)
     report = dict_list_to_presence_minutes_report(students_presence_dict)
     self.assertEqual(set(report), set(result))
예제 #3
0
import argparse
from functions import dict_list_to_presence_minutes_report, file_to_dict, dict_list_to_student_movement_report
from pprint import pprint

parser = argparse.ArgumentParser(
    description="Alumni presence report generation tool, code test for Foris.ai"
)

parser.add_argument('-sp',
                    '--student_presence',
                    type=str,
                    help='.txt file to parse, default is input.txt',
                    default='input.txt')

args = parser.parse_args()
file = args.student_presence
students_presence_dict = file_to_dict(file)
pprint(students_presence_dict)
report = dict_list_to_presence_minutes_report(students_presence_dict)
print(report)

dict_list_to_student_movement_report(students_presence_dict)
예제 #4
0
 def test_empty(self):
     self.assertEqual(file_to_dict('empty_file.txt'), {})
예제 #5
0
 def test_empty(self):
     file = 'empty_file.txt'
     students_presence_dict = file_to_dict(file)
     report = dict_list_to_presence_minutes_report(students_presence_dict)
     self.assertEqual(report, [])
예제 #6
0
 def test_file_not_found(self):
     file = 'no_file.txt'
     self.assertEqual(file_to_dict(file), 0)