def test_grad_studio(self): r = {'section': 'ANIMA-270-09', 'title': 'Graduate Studio Practice', 'dept': 'ANIMA', 'semester': '2015FA', 'faculty': 'Anon Ymouse'} self.assertEqual(has_syllabus(r), False)
# we will trim & lowercase strings before comparison with these values skipped_faculty = ("staff", "standby") # see also: has_syllabus.py, which is used to filter certain courses out # SMTP server if debug is True: server = None else: server = smtplib.SMTP("localhost") # output values data = {} for row in reader: # skip bad values for courses e.g. studio courses w/o syllabi if has_syllabus(row): # skip bad faculty values like "Standby" etc. names = filter(lambda f: f.strip().lower() not in skipped_faculty, row["faculty"].split(", ")) for name in names: # initialize if not in output dict already if name not in data: data[name] = {"courses": [], "username": usernames.get(name)} data[name]["courses"].append(row["section"] + " " + row["title"]) for faculty in data: print(time.strftime("%m/%d/%Y %H:%M:%S"), "notifying %s..." % faculty) notify(faculty, data[faculty]["username"], data[faculty]["courses"], server, args.template) # not sure if necessary but I'd rather not spew out emails so fast time.sleep(1)
def test_comics(self): r = {'section': 'COMIC-615-01', 'title': 'Mentored Study', 'dept': 'COMIC', 'semester': '2016SP', 'faculty': 'Anon Ymouse'} self.assertEqual(has_syllabus(r), True)
def test_mentored_study(self): r = {'section': 'WRITE-660-09', 'title': 'Mentored Study', 'dept': 'WRITE', 'semester': '2015FA', 'faculty': 'Anon Ymouse'} self.assertEqual(has_syllabus(r), False)
def test_regular_course(self): r = {'section': 'ANIMA-270-09', 'title': 'Animation Course', 'dept': 'ANIMA', 'semester': '2015FA', 'faculty': 'Anon Ymouse'} self.assertEqual(has_syllabus(r), True)
def test_696(self): r = {'section': 'ANIMA-696-09', 'title': 'Animation Course', 'dept': 'ANIMA', 'semester': '2015FA', 'faculty': 'Anon Ymouse'} self.assertEqual(has_syllabus(r), False)
def test_independent_study(self): r = {'section': 'ANIMA-270-09', 'title': 'Independent Study', 'dept': 'ANIMA', 'semester': '2015FA', 'faculty': 'Anon Ymouse'} self.assertEqual(has_syllabus(r), False)