+ 1549505284543
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/students/KevinCavanaugh/session5/TestData.txt b/students/KevinCavanaugh/session5/TestData.txt
new file mode 100644
index 0000000..f58fcd9
--- /dev/null
+++ b/students/KevinCavanaugh/session5/TestData.txt
@@ -0,0 +1,10 @@
+1,1
+1,2
+1,3
+1,4
+0,1
+0,2
+0,3
+0,4
+2,1
+2,2
diff --git a/students/KevinCavanaugh/session5/cigar_party.py b/students/KevinCavanaugh/session5/cigar_party.py
new file mode 100644
index 0000000..3b0230a
--- /dev/null
+++ b/students/KevinCavanaugh/session5/cigar_party.py
@@ -0,0 +1,16 @@
+#!/usr/bin/env python
+
+"""
+When squirrels get together for a party, they like to have cigars.
+A squirrel party is successful when the number of cigars is between
+40 and 60, inclusive. Unless it is the weekend, in which case there
+is no upper bound on the number of cigars.
+
+Return True if the party with the given values is successful,
+or False otherwise.
+"""
+
+
+def cigar_party(cigars, is_weekend):
+ return cigars >= 40 and is_weekend
+
diff --git a/students/KevinCavanaugh/session5/class_notes.py b/students/KevinCavanaugh/session5/class_notes.py
new file mode 100644
index 0000000..e69de29
diff --git a/students/KevinCavanaugh/session5/compreshion_lab.py b/students/KevinCavanaugh/session5/compreshion_lab.py
new file mode 100644
index 0000000..f6156ef
--- /dev/null
+++ b/students/KevinCavanaugh/session5/compreshion_lab.py
@@ -0,0 +1,44 @@
+feast = ['spam', 'sloths', 'orangutans', 'breakfast cereals', 'fruit bats']
+
+comp = [delicacy for delicacy in feast if len(delicacy) > 6]
+
+print(len(feast))
+
+print(len(comp))
+
+list_of_tuples = [(1, 'lumberjack'), (2, 'inquisition'), (4, 'spam')]
+
+comprehension = [ number * skit for number, skit in list_of_tuples ]
+
+print(comprehension)
+
+print(comprehension[0])
+
+print(len(comprehension[2]))
+
+dict_of_weapons = {'first': 'fear',
+ 'second': 'surprise',
+ 'third':'ruthless efficiency',
+ 'forth':'fanatical devotion',
+ 'fifth': None}
+
+dict_comprehension = {k.upper(): weapon for k, weapon in dict_of_weapons.items() if weapon}
+
+print('first' in dict_comprehension)
+
+print('FIRST' in dict_comprehension)
+
+print(len(dict_of_weapons))
+print(len(dict_comprehension))
+
+
+def count_evens(nums):
+ even_nums = [num for num in nums if num % 2 == 0]
+ return len(even_nums)
+
+
+print(count_evens([2, 1, 2, 3, 4]))
+print(count_evens([1, 3, 5]))
+
+
+
diff --git a/students/KevinCavanaugh/session5/except_exercise.py b/students/KevinCavanaugh/session5/except_exercise.py
new file mode 100644
index 0000000..26f4d9e
--- /dev/null
+++ b/students/KevinCavanaugh/session5/except_exercise.py
@@ -0,0 +1,55 @@
+#!/usr/bin/python
+
+"""
+An exercise in playing with Exceptions.
+Make lots of try/except blocks for fun and profit.
+
+Make sure to catch specifically the error you find, rather than all errors.
+"""
+
+from except_test import fun, more_fun, last_fun
+
+
+# Figure out what the exception is, catch it and while still
+# in that catch block, try again with the second item in the list
+first_try = ['spam', 'cheese', 'mr death']
+try:
+ joke = fun(first_try[0])
+except NameError:
+ print('Name cannot be found.')
+ joke = fun(first_try[1])
+
+# Here is a try/except block. Add an else that prints not_joke
+try:
+ not_joke = fun(first_try[2])
+except SyntaxError:
+ print('Run Away!')
+else:
+ print(not_joke)
+
+# What did that do? You can think of else in this context, as well as in
+# loops as meaning: "else if nothing went wrong"
+# (no breaks in loops, no exceptions in try blocks)
+
+# Figure out what the exception is, catch it and in that same block
+#
+# try calling the more_fun function with the 2nd language in the list,
+# again assigning it to more_joke.
+#
+# If there are no exceptions, call the more_fun function with the last
+# language in the list
+
+# Finally, while still in the try/except block and regardless of whether
+# there were any exceptions, call the function last_fun with no
+# parameters. (pun intended)
+
+langs = ['java', 'c', 'python']
+
+try:
+ more_joke = more_fun(langs[0])
+except IndexError:
+ print('Index out of range.')
+ more_joke = more_fun(langs[1])
+ more_joke = more_fun(langs[2])
+ last_fun()
+
diff --git a/students/KevinCavanaugh/session5/except_test.py b/students/KevinCavanaugh/session5/except_test.py
new file mode 100644
index 0000000..905dd67
--- /dev/null
+++ b/students/KevinCavanaugh/session5/except_test.py
@@ -0,0 +1,41 @@
+#!/usr/bin/env python3
+
+"""
+silly little test module that is designed to trigger Exceptions when
+run from the except_exercise.py file
+"""
+
+import time
+
+conclude = "And what leads you to that conclusion?"
+district = "Finest in the district, sir."
+cheese = "It's certainly uncontaminated by cheese."
+clean = "Well, it's so clean."
+shop = "Not much of a cheese shop really, is it?"
+cust = "Customer: "
+clerk = "Shopkeeper: "
+
+
+def fun(reaper):
+ if reaper == 'spam':
+ print(s)
+ elif reaper == 'cheese':
+ print()
+ print('Spam, Spam, Spam, Spam, Beautiful Spam')
+ elif reaper == 'mr death':
+ print()
+ return('{}{}\n{}{}'.format(cust, shop, clerk, district))
+
+
+def more_fun(language):
+ if language == 'java':
+ test = [1, 2, 3]
+ test[5] = language
+ elif language == 'c':
+ print('{}{}\n{}{}'.format(cust, conclude, clerk, clean))
+
+
+def last_fun():
+ print(cust, cheese)
+ time.sleep(1)
+ import antigravity
diff --git a/students/KevinCavanaugh/session5/lab 5-1.py b/students/KevinCavanaugh/session5/lab 5-1.py
new file mode 100644
index 0000000..8577212
--- /dev/null
+++ b/students/KevinCavanaugh/session5/lab 5-1.py
@@ -0,0 +1,33 @@
+def sum_numbers(*args):
+ sum = 0
+ for value in args:
+ sum += value
+ return sum
+
+
+def difference_numbers(*args):
+ difference = 0
+ for value in args:
+ difference -= value
+ return difference
+
+
+def product_numbers(*args):
+ product = 1
+ for value in args:
+ product *= value
+ return product
+
+
+def quotient_numbers(*args):
+ quotient = 1
+ for value in args:
+ quotient /= value
+ return quotient
+
+
+print(sum_numbers(1,2,3,4,5))
+print(difference_numbers(1,2,3,4,5))
+print(product_numbers(1,2,3))
+print(quotient_numbers(1,2,3,4,5))
+
diff --git a/students/KevinCavanaugh/session5/mailroom_3.py b/students/KevinCavanaugh/session5/mailroom_3.py
new file mode 100644
index 0000000..45c2e80
--- /dev/null
+++ b/students/KevinCavanaugh/session5/mailroom_3.py
@@ -0,0 +1,125 @@
+#!/usr/bin/env python3
+
+# ----------------------------------------------------------------------- #
+# Title: Mailroom_Part_3
+# Author: Kevin Cavanaugh
+# Change Log: (Who,What,When)
+# kcavanau, created document & completed assignment, 02/10/2019
+# kcavanau, playing with compression and error handling, 02/10/2019
+# ----------------------------------------------------------------------- #
+
+import sys, io, os
+
+
+# -------------------- DATA -------------------- #
+
+donors = {}
+donors['Kevin Cavanaugh'] = (500.55, 899.34, 78.94)
+donors['Victor Murphy'] = (99.89, 87.02)
+donors['Randy Brown'] = (10.11, 1000.01, 99.99)
+donors['Piper Long'] = (190.99, 100.02)
+donors['Kim Pinkie'] = (2344.44, 8999.66, 345.55)
+
+prompt = "\n".join(("What would you like to do?",
+ "1. Send a Thank You to single donor",
+ "2. Create a Report",
+ "3. Send letters to all donors",
+ "4. Quit"))
+
+
+def send_thank_you(name, donation):
+ '''
+
+ :param name:
+ :param donation:
+ :return:
+ '''
+ letter = '\n Dear {}, \n\n Thank you for the generous donation of ${:.2f}. \n We are very grateful for your' \
+ ' donation. \n\n Sincerely, \n The Team'.format(name, donation)
+ return letter + '\n'
+
+
+def add_donation(record, person, donation):
+ if person in record:
+ record[person] += donation,
+ else:
+ record[person] = donation,
+
+
+def donor_stats(donor):
+ total = sum(donors[donor])
+ num_donations = int(len(donors[donor]))
+ avg_donation = int(total / num_donations)
+ return '{:<20} ${:<15.2f} {:<10} ${:<15.2f} '.format(donor, total, num_donations, avg_donation)
+
+
+def create_report():
+ print('{:<20} |{:,<15} |{:<10} |{:,<15} '.format('Donor', 'Total', 'Num Gifts', 'Average Gift'))
+ print('-' * 60)
+ for donor in donors:
+ print(donor_stats(donor))
+ print('\n')
+
+
+def write_letters():
+ cwd = os.getcwd()
+ try:
+ os.mkdir('thank_you_letters')
+ os.chdir('thank_you_letters')
+ except FileExistsError:
+ print('Files already exists. Create new directory.')
+ new_dir = input('New Directory Name: ')
+ os.mkdir(new_dir)
+ os.chdir(new_dir)
+
+ for donor in donors.keys():
+ file_name = ('thank_you_{:s}.txt'.format(donor))
+ open(file_name, 'a').close()
+ file = io.open(file_name, 'w')
+ file.write(send_thank_you(donor, donors[donor][len(donors[donor]) - 1]))
+ file.close()
+
+ os.chdir(cwd)
+
+
+def thank_single_donor():
+ name = input('Enter name of donor: ').lower()
+ while True:
+ if name == 'list':
+ for donor in donors.keys():
+ print(donor)
+ else:
+ try:
+ donation = float(input('How much did {:s} donate?'.format(name)))
+ add_donation(donors, name, donation)
+ print(send_thank_you(name, donors[name][len(donors[name]) - 1]))
+ break
+ except ValueError:
+ print('You must enter a number.')
+
+
+def quit_mailroom():
+ input('Press enter to exit! :) Have nice day')
+ return sys.exit()
+
+
+def user_input(choice):
+ options = {'1': thank_single_donor,
+ '2': create_report,
+ '3': write_letters,
+ '4': quit_mailroom}
+ return options.get(choice)()
+
+
+def main():
+ while True:
+ try:
+ response = input(prompt)
+ user_input(response)
+ except TypeError:
+ print('\n Select a valid option! \n')
+ input('Press enter to continue...')
+
+
+if __name__ == "__main__":
+ main()
diff --git a/students/KevinCavanaugh/session5/new/thank_you_Kevin Cavanaugh.txt b/students/KevinCavanaugh/session5/new/thank_you_Kevin Cavanaugh.txt
new file mode 100644
index 0000000..663edbd
--- /dev/null
+++ b/students/KevinCavanaugh/session5/new/thank_you_Kevin Cavanaugh.txt
@@ -0,0 +1,8 @@
+
+ Dear Kevin Cavanaugh,
+
+ Thank you for the generous donation of $78.94.
+ We are very grateful for your donation.
+
+ Sincerely,
+ The Team
diff --git a/students/KevinCavanaugh/session5/new/thank_you_Kim Pinkie.txt b/students/KevinCavanaugh/session5/new/thank_you_Kim Pinkie.txt
new file mode 100644
index 0000000..f8ca8ff
--- /dev/null
+++ b/students/KevinCavanaugh/session5/new/thank_you_Kim Pinkie.txt
@@ -0,0 +1,8 @@
+
+ Dear Kim Pinkie,
+
+ Thank you for the generous donation of $345.55.
+ We are very grateful for your donation.
+
+ Sincerely,
+ The Team
diff --git a/students/KevinCavanaugh/session5/new/thank_you_Piper Long.txt b/students/KevinCavanaugh/session5/new/thank_you_Piper Long.txt
new file mode 100644
index 0000000..466f27e
--- /dev/null
+++ b/students/KevinCavanaugh/session5/new/thank_you_Piper Long.txt
@@ -0,0 +1,8 @@
+
+ Dear Piper Long,
+
+ Thank you for the generous donation of $100.02.
+ We are very grateful for your donation.
+
+ Sincerely,
+ The Team
diff --git a/students/KevinCavanaugh/session5/new/thank_you_Randy Brown.txt b/students/KevinCavanaugh/session5/new/thank_you_Randy Brown.txt
new file mode 100644
index 0000000..9345d3e
--- /dev/null
+++ b/students/KevinCavanaugh/session5/new/thank_you_Randy Brown.txt
@@ -0,0 +1,8 @@
+
+ Dear Randy Brown,
+
+ Thank you for the generous donation of $99.99.
+ We are very grateful for your donation.
+
+ Sincerely,
+ The Team
diff --git a/students/KevinCavanaugh/session5/new/thank_you_Victor Murphy.txt b/students/KevinCavanaugh/session5/new/thank_you_Victor Murphy.txt
new file mode 100644
index 0000000..e5d9683
--- /dev/null
+++ b/students/KevinCavanaugh/session5/new/thank_you_Victor Murphy.txt
@@ -0,0 +1,8 @@
+
+ Dear Victor Murphy,
+
+ Thank you for the generous donation of $87.02.
+ We are very grateful for your donation.
+
+ Sincerely,
+ The Team
diff --git a/students/KevinCavanaugh/session5/new/thank_you_dan.txt b/students/KevinCavanaugh/session5/new/thank_you_dan.txt
new file mode 100644
index 0000000..75192f2
--- /dev/null
+++ b/students/KevinCavanaugh/session5/new/thank_you_dan.txt
@@ -0,0 +1,8 @@
+
+ Dear dan,
+
+ Thank you for the generous donation of $2.00.
+ We are very grateful for your donation.
+
+ Sincerely,
+ The Team
diff --git a/students/KevinCavanaugh/session5/test_cigar_party.py b/students/KevinCavanaugh/session5/test_cigar_party.py
new file mode 100644
index 0000000..3af7023
--- /dev/null
+++ b/students/KevinCavanaugh/session5/test_cigar_party.py
@@ -0,0 +1,61 @@
+#!/usr/bin/env python
+
+"""
+When squirrels get together for a party, they like to have cigars.
+A squirrel party is successful when the number of cigars is between
+40 and 60, inclusive. Unless it is the weekend, in which case there
+is no upper bound on the number of cigars.
+
+Return True if the party with the given values is successful,
+or False otherwise.
+"""
+
+\
+# you can change this import to test different versions
+from cigar_party import cigar_party
+# from cigar_party import cigar_party2 as cigar_party
+# from cigar_party import cigar_party3 as cigar_party
+
+
+def test_1():
+ assert cigar_party(30, False) is False
+
+
+def test_2():
+ assert cigar_party(50, False) is True
+
+
+def test_3():
+ assert cigar_party(70, True) is True
+
+
+def test_4():
+ assert cigar_party(30, True) is False
+
+
+def test_5():
+ assert cigar_party(50, True) is True
+
+
+def test_6():
+ assert cigar_party(60, False) is True
+
+
+def test_7():
+ assert cigar_party(61, False) is False
+
+
+def test_8():
+ assert cigar_party(40, False) is True
+
+
+def test_9():
+ assert cigar_party(39, False) is False
+
+
+def test_10():
+ assert cigar_party(40, True) is True
+
+
+def test_11():
+ assert cigar_party(39, True) is False
diff --git a/students/KevinCavanaugh/session5/thank_you_letters/thank_you_Kevin Cavanaugh.txt b/students/KevinCavanaugh/session5/thank_you_letters/thank_you_Kevin Cavanaugh.txt
new file mode 100644
index 0000000..663edbd
--- /dev/null
+++ b/students/KevinCavanaugh/session5/thank_you_letters/thank_you_Kevin Cavanaugh.txt
@@ -0,0 +1,8 @@
+
+ Dear Kevin Cavanaugh,
+
+ Thank you for the generous donation of $78.94.
+ We are very grateful for your donation.
+
+ Sincerely,
+ The Team
diff --git a/students/KevinCavanaugh/session5/thank_you_letters/thank_you_Kim Pinkie.txt b/students/KevinCavanaugh/session5/thank_you_letters/thank_you_Kim Pinkie.txt
new file mode 100644
index 0000000..f8ca8ff
--- /dev/null
+++ b/students/KevinCavanaugh/session5/thank_you_letters/thank_you_Kim Pinkie.txt
@@ -0,0 +1,8 @@
+
+ Dear Kim Pinkie,
+
+ Thank you for the generous donation of $345.55.
+ We are very grateful for your donation.
+
+ Sincerely,
+ The Team
diff --git a/students/KevinCavanaugh/session5/thank_you_letters/thank_you_Piper Long.txt b/students/KevinCavanaugh/session5/thank_you_letters/thank_you_Piper Long.txt
new file mode 100644
index 0000000..466f27e
--- /dev/null
+++ b/students/KevinCavanaugh/session5/thank_you_letters/thank_you_Piper Long.txt
@@ -0,0 +1,8 @@
+
+ Dear Piper Long,
+
+ Thank you for the generous donation of $100.02.
+ We are very grateful for your donation.
+
+ Sincerely,
+ The Team
diff --git a/students/KevinCavanaugh/session5/thank_you_letters/thank_you_Randy Brown.txt b/students/KevinCavanaugh/session5/thank_you_letters/thank_you_Randy Brown.txt
new file mode 100644
index 0000000..9345d3e
--- /dev/null
+++ b/students/KevinCavanaugh/session5/thank_you_letters/thank_you_Randy Brown.txt
@@ -0,0 +1,8 @@
+
+ Dear Randy Brown,
+
+ Thank you for the generous donation of $99.99.
+ We are very grateful for your donation.
+
+ Sincerely,
+ The Team
diff --git a/students/KevinCavanaugh/session5/thank_you_letters/thank_you_Victor Murphy.txt b/students/KevinCavanaugh/session5/thank_you_letters/thank_you_Victor Murphy.txt
new file mode 100644
index 0000000..e5d9683
--- /dev/null
+++ b/students/KevinCavanaugh/session5/thank_you_letters/thank_you_Victor Murphy.txt
@@ -0,0 +1,8 @@
+
+ Dear Victor Murphy,
+
+ Thank you for the generous donation of $87.02.
+ We are very grateful for your donation.
+
+ Sincerely,
+ The Team
diff --git a/students/KevinCavanaugh/session6/mailroom_4.py b/students/KevinCavanaugh/session6/mailroom_4.py
new file mode 100644
index 0000000..5a3bd1e
--- /dev/null
+++ b/students/KevinCavanaugh/session6/mailroom_4.py
@@ -0,0 +1,136 @@
+#!/usr/bin/env python3
+
+# ----------------------------------------------------------------------- #
+# Title: Mailroom_Part_3
+# Author: Kevin Cavanaugh
+# Change Log: (Who,What,When)
+# kcavanau, created document & completed assignment, 02/10/2019
+# kcavanau, playing with compression and error handling, 02/10/2019
+# ----------------------------------------------------------------------- #
+
+import sys, io, os
+
+
+# -------------------- DATA -------------------- #
+
+donors = {}
+donors['Kevin Cavanaugh'] = (500.55, 899.34, 78.94)
+donors['Victor Murphy'] = (99.89, 87.02)
+donors['Randy Brown'] = (10.11, 1000.01, 99.99)
+donors['Piper Long'] = (190.99, 100.02)
+donors['Kim Pinkie'] = (2344.44, 8999.66, 345.55)
+
+prompt = "\n".join(("What would you like to do?",
+ "1. Send a Thank You to single donor",
+ "2. Create a Report",
+ "3. Send letters to all donors",
+ "4. Quit"))
+
+
+def send_thank_you(name, donation):
+ '''
+
+ :param name:
+ :param donation:
+ :return:
+ '''
+ letter = '\n Dear {}, \n\n Thank you for the generous donation of ${:.2f}. \n We are very grateful for your' \
+ ' donation. \n\n Sincerely, \n The Team'.format(name, donation)
+ return letter + '\n'
+
+
+def add_donation(record, person, donation):
+ if person in record:
+ record[person] += donation,
+ else:
+ record[person] = donation,
+ return record
+
+
+def donor_stats(donor):
+ total = sum(donors[donor])
+ num_donations = int(len(donors[donor]))
+ avg_donation = int(total / num_donations)
+ return '{:<20} ${:<15.2f} {:<10} ${:<15.2f} '.format(donor, total, num_donations, avg_donation)
+
+
+def create_report(database):
+ report = ('{:<20} |{:<15} |{:<10} |{:<15}\n '.format('Donor', 'Total', 'Num Gifts', 'Average Gift'))
+ report += '-' * 60 + '\n'
+ for donor in database:
+ report += donor_stats(donor) + '\n'
+ return report
+
+
+def display_report():
+ print(create_report(donors))
+
+def write_letters():
+ cwd = os.getcwd()
+ try:
+ os.mkdir('thank_you_letters')
+ os.chdir('thank_you_letters')
+ except FileExistsError:
+ print('Files already exists. Create new directory.')
+ new_dir = input('New Directory Name: ')
+ os.mkdir(new_dir)
+ os.chdir(new_dir)
+
+ for donor in donors.keys():
+ file_name = ('thank_you_{:s}.txt'.format(donor))
+ open(file_name, 'a').close()
+ file = io.open(file_name, 'w')
+ file.write(send_thank_you(donor, donors[donor][len(donors[donor]) - 1]))
+ file.close()
+
+ os.chdir(cwd)
+
+
+def thank_single_donor():
+ name = input('Enter name of donor: ').lower()
+ while True:
+ if name == 'list':
+ print(create_donor_list())
+ break
+ else:
+ try:
+ donation = float(input('How much did {:s} donate?'.format(name)))
+ add_donation(donors, name, donation)
+ print(send_thank_you(name, donors[name][len(donors[name]) - 1]))
+ break
+ except ValueError:
+ print('You must enter a number.')
+
+
+def create_donor_list():
+ donor_list = 'Donors: \n'
+ for donor in donors:
+ donor_list += donor + '\n'
+ return donor_list
+
+
+def quit_mailroom():
+ input('Press enter to exit! :) Have nice day')
+ return sys.exit()
+
+
+def user_input(choice):
+ options = {'1': thank_single_donor,
+ '2': display_report,
+ '3': write_letters,
+ '4': quit_mailroom}
+ return options.get(choice)()
+
+
+def main():
+ while True:
+ try:
+ response = input(prompt)
+ user_input(response)
+ except TypeError:
+ print('\n Select a valid option! \n')
+ input('Press enter to continue...')
+
+
+if __name__ == "__main__":
+ main()
diff --git a/students/KevinCavanaugh/session6/notes.py b/students/KevinCavanaugh/session6/notes.py
new file mode 100644
index 0000000..cc26c41
--- /dev/null
+++ b/students/KevinCavanaugh/session6/notes.py
@@ -0,0 +1,21 @@
+class Person:
+
+ # --Constructor--
+ def __init__(self, FirstName, Email=None): # Overloaded
+ # Instance Attributes
+ self.FirstName = FirstName
+ self.Email = Email
+
+ # --Methods--
+
+ def ToString(self):
+ return self.FirstName + ', ' + str(self.Email)
+
+
+# --End of class--
+
+objP1 = Person("Bob", "BSmith@GoMail.com")
+objP2 = Person("Sue")
+print(objP1.ToString())
+print("-------------")
+print(objP2.ToString())
diff --git a/students/KevinCavanaugh/session6/test_mailroom4.py b/students/KevinCavanaugh/session6/test_mailroom4.py
new file mode 100644
index 0000000..8b3ee6f
--- /dev/null
+++ b/students/KevinCavanaugh/session6/test_mailroom4.py
@@ -0,0 +1,37 @@
+#!/usr/bin/env python
+
+import os
+
+import mailroom_4 as mailroom
+
+donors = {}
+donors['Kevin Cavanaugh'] = (500.55, 899.34, 78.94)
+donors['Victor Murphy'] = (99.89, 87.02)
+donors['Randy Brown'] = (10.11, 1000.01, 99.99)
+donors['Piper Long'] = (190.99, 100.02)
+donors['Kim Pinkie'] = (2344.44, 8999.66, 345.55)
+
+
+def test_donor_list():
+ listing = mailroom.create_donor_list()
+ assert "Kevin Cavanaugh" in listing
+ assert len(listing.split('\n')) == 7
+ assert listing.startswith("Donors: \n")
+
+
+def test_create_report():
+ report = mailroom.create_report(donors)
+ assert report.startswith('Donor |Total |Num Gifts |Average Gift')
+
+
+def test_add_donation():
+ name = "Randal Root"
+ donation = "500"
+ mailroom.add_donation(donors, name, donation)
+ assert donors['Randal Root']
+
+
+def test_write_letter():
+ mailroom.write_letters()
+ assert os.path.isdir('thank_you_letters')
+
diff --git a/students/KevinCavanaugh/session6/thank_you_letters/thank_you_Kevin Cavanaugh.txt b/students/KevinCavanaugh/session6/thank_you_letters/thank_you_Kevin Cavanaugh.txt
new file mode 100644
index 0000000..663edbd
--- /dev/null
+++ b/students/KevinCavanaugh/session6/thank_you_letters/thank_you_Kevin Cavanaugh.txt
@@ -0,0 +1,8 @@
+
+ Dear Kevin Cavanaugh,
+
+ Thank you for the generous donation of $78.94.
+ We are very grateful for your donation.
+
+ Sincerely,
+ The Team
diff --git a/students/KevinCavanaugh/session6/thank_you_letters/thank_you_Kim Pinkie.txt b/students/KevinCavanaugh/session6/thank_you_letters/thank_you_Kim Pinkie.txt
new file mode 100644
index 0000000..f8ca8ff
--- /dev/null
+++ b/students/KevinCavanaugh/session6/thank_you_letters/thank_you_Kim Pinkie.txt
@@ -0,0 +1,8 @@
+
+ Dear Kim Pinkie,
+
+ Thank you for the generous donation of $345.55.
+ We are very grateful for your donation.
+
+ Sincerely,
+ The Team
diff --git a/students/KevinCavanaugh/session6/thank_you_letters/thank_you_Piper Long.txt b/students/KevinCavanaugh/session6/thank_you_letters/thank_you_Piper Long.txt
new file mode 100644
index 0000000..466f27e
--- /dev/null
+++ b/students/KevinCavanaugh/session6/thank_you_letters/thank_you_Piper Long.txt
@@ -0,0 +1,8 @@
+
+ Dear Piper Long,
+
+ Thank you for the generous donation of $100.02.
+ We are very grateful for your donation.
+
+ Sincerely,
+ The Team
diff --git a/students/KevinCavanaugh/session6/thank_you_letters/thank_you_Randy Brown.txt b/students/KevinCavanaugh/session6/thank_you_letters/thank_you_Randy Brown.txt
new file mode 100644
index 0000000..9345d3e
--- /dev/null
+++ b/students/KevinCavanaugh/session6/thank_you_letters/thank_you_Randy Brown.txt
@@ -0,0 +1,8 @@
+
+ Dear Randy Brown,
+
+ Thank you for the generous donation of $99.99.
+ We are very grateful for your donation.
+
+ Sincerely,
+ The Team
diff --git a/students/KevinCavanaugh/session6/thank_you_letters/thank_you_Victor Murphy.txt b/students/KevinCavanaugh/session6/thank_you_letters/thank_you_Victor Murphy.txt
new file mode 100644
index 0000000..e5d9683
--- /dev/null
+++ b/students/KevinCavanaugh/session6/thank_you_letters/thank_you_Victor Murphy.txt
@@ -0,0 +1,8 @@
+
+ Dear Victor Murphy,
+
+ Thank you for the generous donation of $87.02.
+ We are very grateful for your donation.
+
+ Sincerely,
+ The Team
diff --git a/students/KevinCavanaugh/session7/.idea/encodings.xml b/students/KevinCavanaugh/session7/.idea/encodings.xml
new file mode 100644
index 0000000..15a15b2
--- /dev/null
+++ b/students/KevinCavanaugh/session7/.idea/encodings.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/students/KevinCavanaugh/session7/.idea/misc.xml b/students/KevinCavanaugh/session7/.idea/misc.xml
new file mode 100644
index 0000000..7868e69
--- /dev/null
+++ b/students/KevinCavanaugh/session7/.idea/misc.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/students/KevinCavanaugh/session7/.idea/modules.xml b/students/KevinCavanaugh/session7/.idea/modules.xml
new file mode 100644
index 0000000..018e292
--- /dev/null
+++ b/students/KevinCavanaugh/session7/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/students/KevinCavanaugh/session7/.idea/session7.iml b/students/KevinCavanaugh/session7/.idea/session7.iml
new file mode 100644
index 0000000..85c7612
--- /dev/null
+++ b/students/KevinCavanaugh/session7/.idea/session7.iml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/students/KevinCavanaugh/session7/.idea/vcs.xml b/students/KevinCavanaugh/session7/.idea/vcs.xml
new file mode 100644
index 0000000..c2365ab
--- /dev/null
+++ b/students/KevinCavanaugh/session7/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/students/KevinCavanaugh/session7/.idea/workspace.xml b/students/KevinCavanaugh/session7/.idea/workspace.xml
new file mode 100644
index 0000000..f649092
--- /dev/null
+++ b/students/KevinCavanaugh/session7/.idea/workspace.xml
@@ -0,0 +1,251 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1551038102257
+
+
+ 1551038102257
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/students/KevinCavanaugh/session7/html_render.py b/students/KevinCavanaugh/session7/html_render.py
new file mode 100644
index 0000000..ca7db08
--- /dev/null
+++ b/students/KevinCavanaugh/session7/html_render.py
@@ -0,0 +1,212 @@
+#!/usr/bin/env python3
+
+# ----------------------------------------------------------------------- #
+# Title: html_render
+# Author: Kevin Cavanaugh
+# Change Log: (Who,What,When)
+# kcavanau, started assignment, 02/24/2019
+# ----------------------------------------------------------------------- #
+
+"""
+A class-based system for rendering html.
+"""
+
+
+# This is the framework for the base class
+class Element(object):
+
+ tag = "html"
+ content_separator = "\n"
+ content_indent = True
+ indent = 4
+
+ def __init__(self, content=None, **kwargs):
+ self.content = []
+ self.html_attributes = kwargs
+ if content is not None:
+ self.append(content)
+
+ def append(self, new_content):
+ if hasattr(new_content, 'render'):
+ self.content.append(new_content)
+ else:
+ self.content.append(TextWrapper(str(new_content)))
+
+ def render(self, out_file, cur_ind=0):
+ indent_text = ' ' * cur_ind
+ self.tag_open(out_file, indent_text)
+ self.tag_content(out_file, cur_ind)
+ self.tag_close(out_file, indent_text)
+
+ def attributes_text(self):
+ return "".join((f' {attribute}="{value}"' for attribute, value in self.html_attributes.items()))
+
+ def tag_open(self, out_file, indent_text=''):
+ out_file.write(f"{indent_text}<{self.tag}{self.attributes_text()}>{self.content_separator}")
+
+ def tag_close(self, out_file, indent_text=''):
+ out_file.write(f"{indent_text}{self.tag}>")
+
+ def tag_content(self, out_file, curr_ind=0):
+ for line in self.content:
+ line.render(out_file, curr_ind + self.indent)
+ out_file.write(self.content_separator)
+
+
+class TextWrapper:
+ """
+ A simple wrapper that creates a class with a render method
+ for simple text
+ """
+
+ def __init__(self, text):
+ self.text = text
+
+ def render(self, file_out, curr_ind=0):
+ file_out.write(f"{' ' * curr_ind}{self.text}")
+
+
+class Html(Element):
+ """
+ Top Level HTML element
+ """
+ tag = "html"
+
+ def render(self, out_file, cur_ind=0):
+ out_file.write(f"{' ' * cur_ind}\n")
+ Element.render(self, out_file, cur_ind)
+
+
+class Body(Element):
+ """
+ Body HTML element
+ """
+ tag = "body"
+
+
+class P(Element):
+ """
+ Paragraph
HTML element
+ """
+ tag = "p"
+
+
+class Head(Element):
+ """
+ Head HTML element tag
+ """
+ tag = "head"
+
+
+class OneLineTag(Element):
+ """
+ Base class for single line HTML tags
+ """
+ content_separator = ""
+
+ def tag_close(self, out_file, indent_text=''):
+ out_file.write(f"{self.tag}>")
+
+ def tag_content(self, out_file, curr_ind=0):
+ for line in self.content:
+ line.render(out_file, 0)
+ out_file.write(self.content_separator)
+
+
+class Title(OneLineTag):
+ """
+ HTML Title element
+ """
+ tag = "title"
+
+
+class SelfClosingTag(Element):
+ """
+ Base class for self closing tags
+ """
+ content_separator = ""
+
+ def __init__(self, content=None, **kwargs):
+ if content is not None:
+ raise TypeError("Self closing tags cannot have content")
+ Element.__init__(self, **kwargs)
+
+ def append(self, new_content):
+ if new_content is not None:
+ raise TypeError("Self closing tags cannot have content")
+
+ def render(self, out_file, cur_ind=0):
+ """
+ Write the self closing tag with attributes
+ """
+ out_file.write(f"{' ' * cur_ind}<{self.tag}{self.attributes_text()} />")
+
+
+class Hr(SelfClosingTag):
+ """
+ HTML Title element
+ """
+ tag = "hr"
+
+
+class Br(SelfClosingTag):
+ """
+ HTML Title element
+ """
+ tag = "br"
+
+
+class A(OneLineTag):
+ """
+ HTML Anchor (A) element
+ """
+ tag = "a"
+ content_separator = ""
+ indent_content = False
+
+ def __init__(self, link, content=None, **kwargs):
+ kwargs.setdefault("href", link)
+ Element.__init__(self, content, **kwargs)
+
+
+class Ul(Element):
+ """
+ HTML Unordered List (ul) element
+ """
+ tag = "ul"
+
+
+class Li(Element):
+ """
+ HTML List Item (li) element
+ """
+ tag = "li"
+
+
+class H(OneLineTag):
+ """
+ HTML Header (h1, h2, h3, h4, and h5) elements
+ """
+ tag = "h"
+
+ def __init__(self, level, content=None, **kwargs):
+ if 1 > level > 5:
+ raise TypeError("Header must be between 1 and 5")
+ self.tag = f"h{level:d}"
+ Element.__init__(self, content, **kwargs)
+
+
+class Meta(SelfClosingTag):
+ """
+ HTML Meta element
+ """
+ tag = "meta"
+
+
+class Input(Element):
+ """
+ HTML Input element
+ """
+ tag = "input"
+
+
diff --git a/students/KevinCavanaugh/session7/run_html_render.py b/students/KevinCavanaugh/session7/run_html_render.py
new file mode 100644
index 0000000..35d17e2
--- /dev/null
+++ b/students/KevinCavanaugh/session7/run_html_render.py
@@ -0,0 +1,231 @@
+#!/usr/bin/env python3
+
+"""
+a simple script can run and test your html rendering classes.
+
+Uncomment the steps as you add to your rendering.
+
+"""
+
+from io import StringIO
+
+# importing the html_rendering code with a short name for easy typing.
+import html_render as hr
+
+
+# writing the file out:
+def render_page(page, filename, indent=None):
+ """
+ render the tree of elements
+
+ This uses StringIO to render to memory, then dump to console and
+ write to file -- very handy!
+ """
+
+ f = StringIO()
+ if indent is None:
+ page.render(f)
+ else:
+ page.render(f, indent)
+
+ print(f.getvalue())
+ with open(filename, 'w') as outfile:
+ outfile.write(f.getvalue())
+
+
+# Step 1
+#########
+
+page = hr.Element()
+
+page.append("Here is a paragraph of text -- there could be more of them, "
+ "but this is enough to show that we can do some text")
+
+page.append("And here is another piece of text -- you should be able to add any number")
+
+render_page(page, "test_html_output1.html")
+
+# The rest of the steps have been commented out.
+# Uncomment them as you move along with the assignment.
+
+## Step 2
+##########
+
+page = hr.Html()
+
+body = hr.Body()
+
+body.append(hr.P("Here is a paragraph of text -- there could be more of them, "
+ "but this is enough to show that we can do some text"))
+
+body.append(hr.P("And here is another piece of text -- you should be able to add any number"))
+
+page.append(body)
+
+render_page(page, "test_html_output2.html")
+
+# Step 3
+##########
+
+page = hr.Html()
+
+head = hr.Head()
+head.append(hr.Title("PythonClass = Revision 1087:"))
+
+page.append(head)
+
+body = hr.Body()
+
+body.append(hr.P("Here is a paragraph of text -- there could be more of them, "
+ "but this is enough to show that we can do some text"))
+body.append(hr.P("And here is another piece of text -- you should be able to add any number"))
+
+page.append(body)
+
+render_page(page, "test_html_output3.html")
+
+# Step 4
+##########
+
+page = hr.Html()
+
+head = hr.Head()
+head.append(hr.Title("PythonClass = Revision 1087:"))
+
+page.append(head)
+
+body = hr.Body()
+
+body.append(hr.P("Here is a paragraph of text -- there could be more of them, "
+ "but this is enough to show that we can do some text",
+ style="text-align: center; font-style: oblique;"))
+
+page.append(body)
+
+render_page(page, "test_html_output4.html")
+
+# Step 5
+#########
+
+page = hr.Html()
+
+head = hr.Head()
+head.append(hr.Title("PythonClass = Revision 1087:"))
+
+page.append(head)
+
+body = hr.Body()
+
+body.append(hr.P("Here is a paragraph of text -- there could be more of them, "
+ "but this is enough to show that we can do some text",
+ style="text-align: center; font-style: oblique;"))
+
+body.append(hr.Hr())
+
+page.append(body)
+
+render_page(page, "test_html_output5.html")
+
+# Step 6
+#########
+
+page = hr.Html()
+
+head = hr.Head()
+head.append(hr.Title("PythonClass = Revision 1087:"))
+
+page.append(head)
+
+body = hr.Body()
+
+body.append(hr.P("Here is a paragraph of text -- there could be more of them, "
+ "but this is enough to show that we can do some text",
+ style="text-align: center; font-style: oblique;"))
+
+body.append(hr.Hr())
+
+body.append("And this is a ")
+body.append( hr.A("http://google.com", "link") )
+body.append("to google")
+
+page.append(body)
+
+render_page(page, "test_html_output6.html")
+
+# Step 7
+#########
+
+page = hr.Html()
+
+head = hr.Head()
+head.append(hr.Title("PythonClass = Revision 1087:"))
+
+page.append(head)
+
+body = hr.Body()
+
+body.append( hr.H(2, "PythonClass - Class 6 example") )
+
+body.append(hr.P("Here is a paragraph of text -- there could be more of them, "
+ "but this is enough to show that we can do some text",
+ style="text-align: center; font-style: oblique;"))
+
+body.append(hr.Hr())
+
+list = hr.Ul(id="TheList", style="line-height:200%")
+
+list.append( hr.Li("The first item in a list") )
+list.append( hr.Li("This is the second item", style="color: red") )
+
+item = hr.Li()
+item.append("And this is a ")
+item.append( hr.A("http://google.com", "link") )
+item.append("to google")
+
+list.append(item)
+
+body.append(list)
+
+page.append(body)
+
+render_page(page, "test_html_output7.html")
+
+# Step 8 and 9
+##############
+
+page = hr.Html()
+
+
+head = hr.Head()
+head.append( hr.Meta(charset="UTF-8") )
+head.append(hr.Title("PythonClass = Revision 1087:"))
+
+page.append(head)
+
+body = hr.Body()
+
+body.append( hr.H(2, "PythonClass - Example") )
+
+body.append(hr.P("Here is a paragraph of text -- there could be more of them, "
+ "but this is enough to show that we can do some text",
+ style="text-align: center; font-style: oblique;"))
+
+body.append(hr.Hr())
+
+list = hr.Ul(id="TheList", style="line-height:200%")
+
+list.append( hr.Li("The first item in a list") )
+list.append( hr.Li("This is the second item", style="color: red") )
+
+item = hr.Li()
+item.append("And this is a ")
+item.append( hr.A("http://google.com", "link") )
+item.append("to google")
+
+list.append(item)
+
+body.append(list)
+
+page.append(body)
+
+render_page(page, "test_html_output8.html")
diff --git a/students/KevinCavanaugh/session7/test_html_output1.html b/students/KevinCavanaugh/session7/test_html_output1.html
new file mode 100644
index 0000000..343b799
--- /dev/null
+++ b/students/KevinCavanaugh/session7/test_html_output1.html
@@ -0,0 +1,4 @@
+
+ Here is a paragraph of text -- there could be more of them, but this is enough to show that we can do some text
+ And here is another piece of text -- you should be able to add any number
+
\ No newline at end of file
diff --git a/students/KevinCavanaugh/session7/test_html_output2.html b/students/KevinCavanaugh/session7/test_html_output2.html
new file mode 100644
index 0000000..25d5cdc
--- /dev/null
+++ b/students/KevinCavanaugh/session7/test_html_output2.html
@@ -0,0 +1,11 @@
+
+
+
+
+ Here is a paragraph of text -- there could be more of them, but this is enough to show that we can do some text
+
+
+ And here is another piece of text -- you should be able to add any number
+
+
+
\ No newline at end of file
diff --git a/students/KevinCavanaugh/session7/test_html_output3.html b/students/KevinCavanaugh/session7/test_html_output3.html
new file mode 100644
index 0000000..b5b308c
--- /dev/null
+++ b/students/KevinCavanaugh/session7/test_html_output3.html
@@ -0,0 +1,14 @@
+
+
+
+ PythonClass = Revision 1087:
+
+
+
+ Here is a paragraph of text -- there could be more of them, but this is enough to show that we can do some text
+
+
+ And here is another piece of text -- you should be able to add any number
+
+
+
\ No newline at end of file
diff --git a/students/KevinCavanaugh/session7/test_html_output4.html b/students/KevinCavanaugh/session7/test_html_output4.html
new file mode 100644
index 0000000..671fee7
--- /dev/null
+++ b/students/KevinCavanaugh/session7/test_html_output4.html
@@ -0,0 +1,11 @@
+
+
+
+ PythonClass = Revision 1087:
+
+
+
+ Here is a paragraph of text -- there could be more of them, but this is enough to show that we can do some text
+
+
+
\ No newline at end of file
diff --git a/students/KevinCavanaugh/session7/test_html_output5.html b/students/KevinCavanaugh/session7/test_html_output5.html
new file mode 100644
index 0000000..92d4748
--- /dev/null
+++ b/students/KevinCavanaugh/session7/test_html_output5.html
@@ -0,0 +1,12 @@
+
+
+
+ PythonClass = Revision 1087:
+
+
+
+ Here is a paragraph of text -- there could be more of them, but this is enough to show that we can do some text
+
+
+
+
\ No newline at end of file
diff --git a/students/KevinCavanaugh/session7/test_html_output6.html b/students/KevinCavanaugh/session7/test_html_output6.html
new file mode 100644
index 0000000..342e88c
--- /dev/null
+++ b/students/KevinCavanaugh/session7/test_html_output6.html
@@ -0,0 +1,15 @@
+
+
+
+ PythonClass = Revision 1087:
+
+
+
+ Here is a paragraph of text -- there could be more of them, but this is enough to show that we can do some text
+
+
+ And this is a
+ link
+ to google
+
+
\ No newline at end of file
diff --git a/students/KevinCavanaugh/session7/test_html_output7.html b/students/KevinCavanaugh/session7/test_html_output7.html
new file mode 100644
index 0000000..e4b059e
--- /dev/null
+++ b/students/KevinCavanaugh/session7/test_html_output7.html
@@ -0,0 +1,26 @@
+
+
+
+ PythonClass = Revision 1087:
+
+
+
PythonClass - Class 6 example
+
+ Here is a paragraph of text -- there could be more of them, but this is enough to show that we can do some text
+
+
+
\ No newline at end of file
diff --git a/students/KevinCavanaugh/session7/test_html_render.py b/students/KevinCavanaugh/session7/test_html_render.py
new file mode 100644
index 0000000..c8b9e07
--- /dev/null
+++ b/students/KevinCavanaugh/session7/test_html_render.py
@@ -0,0 +1,351 @@
+"""
+test code for html_render.py
+
+This is just a start -- you will need more tests!
+"""
+
+import io
+import pytest
+
+# import * is often bad form, but makes it easier to test everything in a module.
+from html_render import *
+
+
+# utility function for testing render methods
+# needs to be used in multiple tests, so we write it once here.
+def render_result(element, ind=""):
+ """
+ calls the element's render method, and returns what got rendered as a
+ string
+ """
+ # the StringIO object is a "file-like" object -- something that
+ # provides the methods of a file, but keeps everything in memory
+ # so it can be used to test code that writes to a file, without
+ # having to actually write to disk.
+ outfile = io.StringIO()
+ # this so the tests will work before we tackle indentation
+ if ind:
+ element.render(outfile, ind)
+ else:
+ element.render(outfile)
+ return outfile.getvalue()
+
+########
+# Step 1
+########
+
+
+def test_init():
+ """
+ This only tests that it can be initialized with and without
+ some content -- but it's a start
+ """
+ e = Element()
+
+ e = Element("this is some text")
+
+
+def test_append():
+ """
+ This tests that you can append text
+
+ It doesn't test if it works --
+ that will be covered by the render test later
+ """
+ e = Element("this is some text")
+ e.append("some more text")
+
+
+def test_render_element():
+ """
+ Tests whether the Element can render two pieces of text
+ So it is also testing that the append method works correctly.
+
+ It is not testing whether indentation or line feeds are correct.
+ """
+ e = Element("this is some text")
+ e.append("and this is some more text")
+
+ # This uses the render_results utility above
+ file_contents = render_result(e).strip()
+
+ # making sure the content got in there.
+ assert("this is some text") in file_contents
+ assert("and this is some more text") in file_contents
+
+ # make sure it's in the right order
+ assert file_contents.index("this is") < file_contents.index("and this")
+
+ # making sure the opening and closing tags are right.
+ assert file_contents.startswith("")
+ assert file_contents.endswith("")
+
+
+# Uncomment this one after you get the one above to pass
+# Does it pass right away?
+def test_render_element2():
+ """
+ Tests whether the Element can render two pieces of text
+ So it is also testing that the append method works correctly.
+
+ It is not testing whether indentation or line feeds are correct.
+ """
+ e = Element()
+ e.append("this is some text")
+ e.append("and this is some more text")
+
+ # This uses the render_results utility above
+ file_contents = render_result(e).strip()
+
+ # making sure the content got in there.
+ assert("this is some text") in file_contents
+ assert("and this is some more text") in file_contents
+
+ # make sure it's in the right order
+ assert file_contents.index("this is") < file_contents.index("and this")
+
+ # making sure the opening and closing tags are right.
+ assert file_contents.startswith("")
+ assert file_contents.endswith("")
+
+
+# ########
+# # Step 2
+# ########
+
+# tests for the new tags
+def test_html():
+ e = Html("this is some text")
+ e.append("and this is some more text")
+
+ file_contents = render_result(e).strip()
+
+ assert("this is some text") in file_contents
+ assert("and this is some more text") in file_contents
+ print(file_contents)
+ assert file_contents.endswith("