tests

.py

School

University of California, Santa Barbara *

*We aren’t endorsed by this school

Course

CMPSC8

Subject

Industrial Engineering

Date

Feb 20, 2024

Type

py

Pages

2

Uploaded by MinisterPencil13164

Report
from functions import * test_tasks = [ { "name": "Collect unicorn glitter", "info": "", "rank": 3, "due": '05/28/2042', "done": True }, { 'name': 'Build a time machine', 'info': 'Clean the parabolic collector reflectors', 'rank': 5, 'due': '06/05/2042', 'done': False }, { "name": "Take a quantum leap", "info": "Ignore all safety rules for best results", "rank": 5, "due": '06/05/2042', "done": False } ] print_task(test_tasks[0], name_only = True) print_task(test_tasks[1]) print_tasks_list(test_tasks, show_completed = True, name_only = True, show_idx = True) print_tasks_list(test_tasks, show_completed = True, name_only = True) print_tasks_list(test_tasks, show_completed = False, name_only = True) assert delete_task([], 1) == 0 assert delete_task([1, 2], 1) == -1 assert delete_task([], 1) == 0 assert delete_task([1, 2], 1) == -1 assert is_valid_date('02/29/2020') == True assert is_valid_date('12/32/2010') == False assert is_valid_date('') == True assert check_valid_field('name', 'a') == 'name' assert check_valid_field('name', '') == 'name' assert check_valid_field('name', 'tada') == 'valid' assert check_valid_field('rank', '') == 'valid' assert check_valid_field('rank', '3') == 'valid' assert check_valid_field('rank', '4') == 'rank' assert check_valid_field('done', '') == 'done' assert check_valid_field('done', 'y') == 'valid' assert check_valid_field('due', '') == 'valid' assert check_valid_field('due', '10/12/2023') == 'valid' assert check_valid_field('due', '2/29/2023') == 'due' assert check_valid_field('money', '2000') == 'money' assert check_valid_field('due', '04/29/2005') == 'valid' assert get_new_task({'name': 'Read', 'info': 'Tolkien', 'rank': '2', 'due': '09/21/2013', 'done': 'eiaou'}) == 'done' assert get_new_task({'name': 'Read', 'info': 'Tolkien', 'rank': '2', 'due': '09/21/2013', 'done': 'n'}) == {'name': 'Read', 'info': 'Tolkien', 'rank': 2, 'due': '09/21/2013', 'done':False} assert is_valid_year(['14', '07', 2001])== False assert days_in_feb(1913) == 28 assert is_valid_month(['12', '07', '2001']) == True assert is_valid_day(['12', '07', '2001']) == True
assert is_valid_year(['14', '07', 2002])== False assert days_in_feb(2023) == 28 assert is_valid_month(['10', '07', '2001']) == True assert is_valid_day(['12', '21', '2001']) == True assert is_valid_year(['14', '07', 1999])== False assert days_in_feb(2003) == 28 assert is_valid_month(['07', '07', '2001']) == True assert is_valid_day(['12', '23', '2001']) == True assert get_new_task({'name': 'Collect space dust', 'info': '', 'rank': '3', 'due': '05/28/2042', 'done': 'n'}) == {'name': 'Collect space dust', 'info': '', 'rank': 3, 'due': '05/28/2042', 'done': False} assert update_task({'name': 'Give Independence', 'info': 'Remove Colonization', 'rank': '5', 'due': '', 'done': True}, 'rank', '5') == {'name': 'Give Independence', 'info': 'Remove Colonization', 'rank': 5, 'due': '', 'done': True} assert update_task({'name': 'Give Independence', 'info': 'Remove Colonization', 'rank': '5', 'due': '', 'done': True}, 'rank', '3') == {'name': 'Give Independence', 'info': 'Remove Colonization', 'rank': 3, 'due': '', 'done': True} assert update_task({'name': 'Give Independence', 'info': 'Remove Colonization', 'rank': '5', 'due': '', 'done': True}, 'rank', '1') == {'name': 'Give Independence', 'info': 'Remove Colonization', 'rank': 1, 'due': '', 'done': True} assert get_task([{'name': 'Collect unicorn glitter', 'info': '', 'rank': 3, 'due': '05/28/2042', 'done': True}], '-5') == -1 assert get_task([{'name': 'Collect unicorn glitter', 'info': '', 'rank': 3, 'due': '05/28/2042', 'done': True}], '-7') == -1 assert get_task([{'name': 'Collect unicorn glitter', 'info': '', 'rank': 3, 'due': '05/28/2042', 'done': True}], '-3') == -1
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help