from TomeRater import * Tome_Rater = TomeRater() #Create some books: book1 = Tome_Rater.create_book("Society of Mind", 12345678) novel1 = Tome_Rater.create_novel("Alice In Wonderland", "Lewis Carroll", 12345) novel1.set_isbn(9781536831139) nonfiction1 = Tome_Rater.create_non_fiction("Automate the Boring Stuff", "Python", "beginner", 1929452) nonfiction2 = Tome_Rater.create_non_fiction("Computing Machinery and Intelligence", "AI", "advanced", 11111938) novel2 = Tome_Rater.create_novel("The Diamond Age", "Neal Stephenson", 10101010) novel3 = Tome_Rater.create_novel("There Will Come Soft Rains", "Ray Bradbury", 10001000) #Create users: Tome_Rater.add_user("Alan Turing", "*****@*****.**") Tome_Rater.add_user("David Marr", "*****@*****.**") #Add a user with three books already read: Tome_Rater.add_user("Marvin Minsky", "*****@*****.**", user_books=[book1, novel1, nonfiction1]) #Add books to a user one by one, with ratings: Tome_Rater.add_book_to_user(book1, "*****@*****.**", 1) Tome_Rater.add_book_to_user(novel1, "*****@*****.**", 3) Tome_Rater.add_book_to_user(nonfiction1, "*****@*****.**", 3) Tome_Rater.add_book_to_user(nonfiction2, "*****@*****.**", 4) Tome_Rater.add_book_to_user(novel3, "*****@*****.**", 1) Tome_Rater.add_book_to_user(novel2, "*****@*****.**", 2) Tome_Rater.add_book_to_user(novel3, "*****@*****.**", 2) Tome_Rater.add_book_to_user(novel3, "*****@*****.**", 4)
from EmailUtil import * from TomeRater import * Tome_Rater = TomeRater() #Create some books: book1 = Tome_Rater.create_book("Society of Mind", 12345678) novel1 = Tome_Rater.create_novel("Alice In Wonderland", "Lewis Carroll", 12345) novel1.set_isbn(9781536831139) nonfiction1 = Tome_Rater.create_non_fiction("Automate the Boring Stuff", "Python", "beginner", 1929452) nonfiction2 = Tome_Rater.create_non_fiction( "Computing Machinery and Intelligence", "AI", "advanced", 11111938) novel2 = Tome_Rater.create_novel("The Diamond Age", "Neal Stephenson", 10101010) novel3 = Tome_Rater.create_novel("There Will Come Soft Rains", "Ray Bradbury", 10001000) #Create users: Tome_Rater.add_user("Alan Turing", "*****@*****.**") Tome_Rater.add_user("David Marr", "*****@*****.**") #Add a user with three books already read: Tome_Rater.add_user("Marvin Minsky", "*****@*****.**", user_books=[book1, novel1, nonfiction1]) #Add books to a user one by one, with ratings: Tome_Rater.add_book_to_user(book1, "*****@*****.**", 1) Tome_Rater.add_book_to_user(novel1, "*****@*****.**", 3) Tome_Rater.add_book_to_user(nonfiction1, "*****@*****.**", 3)
from TomeRater import * Tome_Rater = TomeRater() #Create some books: book1 = Tome_Rater.create_book("Society of Mind", 12345678) novel1 = Tome_Rater.create_novel("Alice In Wonderland", "Lewis Carroll", 12345) novel1.set_isbn(9781536831139) nonfiction1 = Tome_Rater.create_non_fiction("Automate the Boring Stuff", "Python", "beginner", 1929452) nonfiction2 = Tome_Rater.create_non_fiction( "Computing Machinery and Intelligence", "AI", "advanced", 11111938) novel2 = Tome_Rater.create_novel("The Diamond Age", "Neal Stephenson", 10101010) novel3 = Tome_Rater.create_novel("There Will Come Soft Rains", "Ray Bradbury", 10001000) book3 = Tome_Rater.create_book("The Collective Works of C. G. Jung", 12345678) #Create users: Tome_Rater.add_user("Alan Turing", "*****@*****.**") Tome_Rater.add_user("David Marr", "*****@*****.**") #Add a user with three books already read: Tome_Rater.add_user("Marvin Minsky", "*****@*****.**", user_books=[book1, novel1, nonfiction1]) Tome_Rater.add_user("David Marr", "*****@*****.**") #Add books to a user one by one, with ratings: Tome_Rater.add_book_to_user(book1, "*****@*****.**", 1) Tome_Rater.add_book_to_user(novel1, "*****@*****.**", 3) Tome_Rater.add_book_to_user(nonfiction1, "*****@*****.**", 3)
from TomeRater import * Tome_Rater = TomeRater() #Create some books: book1 = Tome_Rater.create_book("Society of Mind", 12345678) novel1 = Tome_Rater.create_novel("Alice In Wonderland", "Lewis Carroll", 12345) novel1.set_isbn(9781536831139) nonfiction1 = Tome_Rater.create_non_fiction("Automate the Boring Stuff", "Python", "beginner", 1929452) nonfiction2 = Tome_Rater.create_non_fiction( "Computing Machinery and Intelligence", "AI", "advanced", 11111938) novel2 = Tome_Rater.create_novel("The Diamond Age", "Neal Stephenson", 10101010) novel3 = Tome_Rater.create_novel("There Will Come Soft Rains", "Ray Bradbury", 10001000) book2 = Tome_Rater.create_book("Another Book", 12345677) #Create users: Tome_Rater.add_user("Alan Turing", "*****@*****.**") Tome_Rater.add_user("David Marr", "*****@*****.**") #Add a user with three books already read: Tome_Rater.add_user("Marvin Minsky", "*****@*****.**", user_books=[book1, novel1, nonfiction1]) #Add books to a user one by one, with ratings: Tome_Rater.add_book_to_user(book1, "*****@*****.**", 1) Tome_Rater.add_book_to_user(novel1, "*****@*****.**", 3) Tome_Rater.add_book_to_user(nonfiction1, "*****@*****.**", 3)
from TomeRater import * Tome_Rater = TomeRater() # Create some books: book1 = Tome_Rater.create_book("Society of Mind", 12345678) novel1 = Tome_Rater.create_novel("Alice In Wonderland", "Lewis Carroll", 12345) novel1.set_isbn(9781536831139) nonfiction1 = Tome_Rater.create_non_fiction("Automate the Boring Stuff", "Python", "beginner", 1929452) nonfiction2 = Tome_Rater.create_non_fiction("Computing Machinery and Intelligence", "AI", "advanced", 11111938) novel2 = Tome_Rater.create_novel("The Diamond Age", "Neal Stephenson", 10101010) novel3 = Tome_Rater.create_novel("There Will Come Soft Rains", "Ray Bradbury", 10001000) book2 = Tome_Rater.create_book('Harry Potter', 12345) book3 = Tome_Rater.create_book('Enders Game', 56789) # Create users: Tome_Rater.add_user("Alan Turing", "*****@*****.**") Tome_Rater.add_user("David Marr", "*****@*****.**") # Add a user with three books already read: Tome_Rater.add_user("Marvin Minsky", "*****@*****.**", user_books=[book1, novel1, nonfiction1]) Tome_Rater.add_user('Dylan Griffith', '*****@*****.**') Tome_Rater.add_user('Dylan Griffith', '*****@*****.**') # # Add books to a user one by one, with ratings: Tome_Rater.add_book_to_user(book1, "*****@*****.**", 1.5) Tome_Rater.add_book_to_user(novel1, "*****@*****.**", 3) Tome_Rater.add_book_to_user(nonfiction1, "*****@*****.**", 3) Tome_Rater.add_book_to_user(nonfiction2, "*****@*****.**", 4)
from TomeRater import * Tome_Rater = TomeRater() #Create some books: book1 = Tome_Rater.create_book("Society of Mind", 12345678) book2 = Tome_Rater.create_book('test', 12345678) book3 = Tome_Rater.create_book('test', 12345678) novel1 = Tome_Rater.create_novel("Alice In Wonderland", "Lewis Carroll", 12345) novel1.set_isbn(9781536831139) nonfiction1 = Tome_Rater.create_non_fiction("Automate the Boring Stuff", "Python", "beginner", 1929452) nonfiction2 = Tome_Rater.create_non_fiction( "Computing Machinery and Intelligence", "AI", "advanced", 11111938) novel2 = Tome_Rater.create_novel("The Diamond Age", "Neal Stephenson", 10101010) novel3 = Tome_Rater.create_novel("There Will Come Soft Rains", "Ray Bradbury", 10001000) #Create users: Tome_Rater.add_user("Alan Turing", "*****@*****.**") Tome_Rater.add_user("David Marr", "*****@*****.**") #Add a user with three books already read: Tome_Rater.add_user("Marvin Minsky", "*****@*****.**", user_books=[book1, novel1, nonfiction1]) #Add books to a user one by one, with ratings: Tome_Rater.add_book_to_user(book1, "*****@*****.**", 1) Tome_Rater.add_book_to_user(novel1, "*****@*****.**", 3)
from TomeRater import * Tome_Rater = TomeRater() #Create some books: book1 = Tome_Rater.create_book("Society of Mind", 12345678, 10) novel1 = Tome_Rater.create_novel("Alice In Wonderland", "Lewis Carroll", 12345, 20) novel1.set_isbn(9781536831139) nonfiction1 = Tome_Rater.create_non_fiction("Automate the Boring Stuff", "Python", "beginner", 1929452, 30) nonfiction2 = Tome_Rater.create_non_fiction( "Computing Machinery and Intelligence", "AI", "advanced", 11111938, 40) novel2 = Tome_Rater.create_novel("The Diamond Age", "Neal Stephenson", 10101010, 50) novel3 = Tome_Rater.create_novel("There Will Come Soft Rains", "Ray Bradbury", 10001000, 60) #Create users: Tome_Rater.add_user("Alan Turing", "*****@*****.**") Tome_Rater.add_user("David Marr", "*****@*****.**") #Add a user with three books already read: Tome_Rater.add_user("Marvin Minsky", "*****@*****.**", user_books=[book1, novel1, nonfiction1]) #Add books to a user one by one, with ratings: Tome_Rater.add_book_to_user(book1, "*****@*****.**", 1) Tome_Rater.add_book_to_user(novel1, "*****@*****.**", 3) Tome_Rater.add_book_to_user(nonfiction1, "*****@*****.**", 3)
from TomeRater import * Tome_Rater = TomeRater() #Create some books: book1 = Tome_Rater.create_book("Society of Mind", 12345678) book2 = Tome_Rater.create_book("Thinking Fast and Slow", 12345678) novel1 = Tome_Rater.create_novel("Alice In Wonderland", "Lewis Carroll", 12345) novel1.set_isbn(9781536831139) nonfiction1 = Tome_Rater.create_non_fiction("Automate the Boring Stuff", "Python", "beginner", 1929452) nonfiction2 = Tome_Rater.create_non_fiction("Computing Machinery and Intelligence", "AI", "advanced", 11111938) novel2 = Tome_Rater.create_novel("The Diamond Age", "Neal Stephenson", 10101010) novel3 = Tome_Rater.create_novel("There Will Come Soft Rains", "Ray Bradbury", 10001000) #Create users: Tome_Rater.add_user("Alan Turing", "*****@*****.**") # Tome_Rater.add_user("Alan II Turing", "alanIIturing.com") Tome_Rater.add_user("David Marr", "*****@*****.**") #Add a user with three books already read: Tome_Rater.add_user("Marvin Minsky", "*****@*****.**", user_books=[book1, novel1, nonfiction1]) #Add books to a user one by one, with ratings: Tome_Rater.add_book_to_user(book1, "*****@*****.**", 1) Tome_Rater.add_book_to_user(novel1, "*****@*****.**", 3) Tome_Rater.add_book_to_user(nonfiction1, "*****@*****.**", 3) Tome_Rater.add_book_to_user(nonfiction2, "*****@*****.**", 4) Tome_Rater.add_book_to_user(novel3, "*****@*****.**", 1) Tome_Rater.add_book_to_user(novel2, "*****@*****.**", 2) Tome_Rater.add_book_to_user(novel3, "*****@*****.**", 2)
from TomeRater import * Tome_Rater = TomeRater() #Create some books: book1 = Tome_Rater.create_book("Society of Mind", 12345678) novel1 = Tome_Rater.create_novel("Alice In Wonderland", "Lewis Carroll", 12345) novel1.set_isbn(9781536831139) book1.set_isbn(978153683113) nonfiction1 = Tome_Rater.create_non_fiction("Automate the Boring Stuff", "Python", "beginner", 1929452) nonfiction2 = Tome_Rater.create_non_fiction("Computing Machinery and Intelligence", "AI", "advanced", 11111938) novel2 = Tome_Rater.create_novel("The Diamond Age", "Neal Stephenson", 10101010) novel3 = Tome_Rater.create_novel("There Will Come Soft Rains", "Ray Bradbury", 10001000) #Create users: print("Create Users") Tome_Rater.add_user("Alan Turing", "*****@*****.**") Tome_Rater.add_user("David Marr", "*****@*****.**") #Add a user with three books already read: Tome_Rater.add_user("Marvin Minsky", "*****@*****.**", user_books=[book1, novel1, nonfiction1]) #Add books to a user one by one, with ratings: print("Add book to user") Tome_Rater.add_book_to_user(book1, "*****@*****.**", 1) Tome_Rater.add_book_to_user(novel1, "*****@*****.**", 3) Tome_Rater.add_book_to_user(nonfiction1, "*****@*****.**", 3) Tome_Rater.add_book_to_user(nonfiction2, "*****@*****.**", 4) Tome_Rater.add_book_to_user(novel3, "*****@*****.**", 1)
from TomeRater import * Tome_Rater1 = TomeRater() #Create some books: book1 = Tome_Rater1.create_book("Society of Mind", 12345678, 10) novel1 = Tome_Rater1.create_novel("Alice In Wonderland", "Lewis Carroll", 12345, 20) novel1.set_isbn(9781536831139) nonfiction1 = Tome_Rater1.create_non_fiction("Automate the Boring Stuff", "Python", "beginner", 1929452, 50) nonfiction2 = Tome_Rater1.create_non_fiction( "Computing Machinery and Intelligence", "AI", "advanced", 11111938, 20) novel2 = Tome_Rater1.create_novel("The Diamond Age", "Neal Stephenson", 10101010) novel3 = Tome_Rater1.create_novel("There Will Come Soft Rains", "Ray Bradbury", 10001000) #Create users: Tome_Rater1.add_user("Alan Turing", "*****@*****.**") Tome_Rater1.add_user("David Marr", "*****@*****.**") #Add a user with three books already read: Tome_Rater1.add_user("Marvin Minsky", "*****@*****.**", user_books=[book1, novel1, nonfiction1]) #Add books to a user one by one, with ratings: Tome_Rater1.add_book_to_user(book1, "*****@*****.**", 1) Tome_Rater1.add_book_to_user(novel1, "*****@*****.**", 3) Tome_Rater1.add_book_to_user(nonfiction1, "*****@*****.**", 3)
from TomeRater import * Tome_Rater = TomeRater() #Create some books: book1 = Tome_Rater.create_book("Society of Mind", 12345678) novel1 = Tome_Rater.create_novel("Alice In Wonderland", "Lewis Carroll", 12345) novel1.set_isbn(9781536831139) nonfiction1 = Tome_Rater.create_non_fiction("Automate the Boring Stuff", "Python", "beginner", 1929452) nonfiction2 = Tome_Rater.create_non_fiction( "Computing Machinery and Intelligence", "AI", "advanced", 11111938) novel2 = Tome_Rater.create_novel("The Diamond Age", "Neal Stephenson", 10101010) novel3 = Tome_Rater.create_novel("There Will Come Soft Rains", "Ray Bradbury", 10001000) #Test already existing ISBN book2 = Tome_Rater.create_book("Das fliegende Klassenzimmer", 12345678) #Create users: Tome_Rater.add_user("Alan Turing", "*****@*****.**") #Test if email-address already exists #Tome_Rater.add_user("Alan Turing", "*****@*****.**") Tome_Rater.add_user("David Marr", "*****@*****.**") #Add a user with three books already read: Tome_Rater.add_user("Marvin Minsky", "*****@*****.**", user_books=[book1, novel1, nonfiction1]) #Test if email-address is valid Tome_Rater.add_user("Hans Meier", "*****@*****.**",
from TomeRater import * Tome_Rater = TomeRater() #Create some books: book1 = Tome_Rater.create_book("Society of Mind", 12345678) book3 = Tome_Rater.create_book( "Test book", 12345678) # this is to test the duplicate ISBN number #Creates some more books novel1 = Tome_Rater.create_novel("Alice In Wonderland", "Lewis Carroll", 12345) novel1.set_isbn(9781536831139) nonfiction1 = Tome_Rater.create_non_fiction("Automate the Boring Stuff", "Python", "beginner", 1929452) nonfiction2 = Tome_Rater.create_non_fiction( "Computing Machinery and Intelligence", "AI", "advanced", 11111938) novel2 = Tome_Rater.create_novel("The Diamond Age", "Neal Stephenson", 10101010) novel3 = Tome_Rater.create_novel("There Will Come Soft Rains", "Ray Bradbury", 10001000) #Create users: Tome_Rater.add_user("Alan Turing", "*****@*****.**") Tome_Rater.add_user("David Marr", "*****@*****.**") Tome_Rater.add_user("Alan Turing", "*****@*****.**") #this tests for a duplicate email Tome_Rater.add_user("test1", "test1.com") # this tests if the email is valid Tome_Rater.add_user("test2", "[email protected]") # this tests if the email is valid Tome_Rater.add_user("test3", "[email protected]") # this tests if the email is valid #Add a user with three books already read:
from TomeRater import * Tome_Rater = TomeRater() #Create some books: book1 = Tome_Rater.create_book("Society of Mind", 12345678) novel1 = Tome_Rater.create_novel("Alice In Wonderland", "Lewis Carroll", 12345) novel1.set_isbn(9781536831139) nonfiction1 = Tome_Rater.create_non_fiction("Automate the Boring Stuff", "Python", "beginner", 1929452) nonfiction2 = Tome_Rater.create_non_fiction( "Computing Machinery and Intelligence", "AI", "advanced", 11111938) novel2 = Tome_Rater.create_novel("The Diamond Age", "Neal Stephenson", 10101010) novel3 = Tome_Rater.create_novel("There Will Come Soft Rains", "Ray Bradbury", 10001000) novel3_copy = Tome_Rater.create_novel("There Will Come Soft Rains", "Ray Bradbury", 10001000) #Create users: Tome_Rater.add_user("Alan Turing", "*****@*****.**") Tome_Rater.add_user("David Marr", "*****@*****.**") #Add a user with three books already read: Tome_Rater.add_user("Marvin Minsky", "*****@*****.**", [book1, novel1, nonfiction1]) #Add books to a user one by one, with ratings: Tome_Rater.add_book_to_user(book1, "*****@*****.**", 1) Tome_Rater.add_book_to_user(novel1, "*****@*****.**", 3) Tome_Rater.add_book_to_user(nonfiction1, "*****@*****.**", 3)
from TomeRater import * Tome_Rater = TomeRater() #Create some books: print('creating books') book1 = Tome_Rater.create_book("Society of Mind", 12345678) novel1 = Tome_Rater.create_novel("Alice In Wonderland", "Lewis Carroll", 12345, 15.0) novel1.set_isbn(9781536831139) nonfiction1 = Tome_Rater.create_non_fiction("Automate the Boring Stuff", "Python", "beginner", 1929452, 20) nonfiction2 = Tome_Rater.create_non_fiction( "Computing Machinery and Intelligence", "AI", "advanced", 11111938, 30.0) novel2 = Tome_Rater.create_novel("The Diamond Age", "Neal Stephenson", 10101010, 18.0) novel3 = Tome_Rater.create_novel("There Will Come Soft Rains", "Ray Bradbury", 10001000, 17.0) book2 = Tome_Rater.create_book("Starship Society", 10001000, 19.0) #Create users: print('creating users') Tome_Rater.add_user("Alan Turing", "*****@*****.**") Tome_Rater.add_user("David Marr", "*****@*****.**") Tome_Rater.add_user("David May", "*****@*****.**") Tome_Rater.add_user("David May", "*****@*****.**") Tome_Rater.add_user("Dave Man", "*****@*****.**") #Add a user with three books already read: print('adding users with 3 books read') Tome_Rater.add_user("Marvin Minsky",
ww2 = Book('World War II at Sea: A Global History', 190243678) ww3 = Book('World War II at Sea: A Global History', 190243678) pap = Fiction('Pride and Prejudice', 'Jane Austen', 679783261) pap2 = Fiction('Pride and Prejudice', 'Jane Austen', 679783261) man0 = Non_Fiction('The Society of Mind', 'Artificial Intelligence', 'Beginner', 671657135) man1 = Non_Fiction('On Cooking', 'Culinary', 'Expert', 131713272) man2 = Non_Fiction('On Cooking', 'Culinary Arts', 'Expert', 131713272) rater = TomeRater() print('==================================================================') print('==================== TESTING TomeRater Class =====================') print('==================================================================') ##################################### BOOKS ################################# r_ww = rater.create_book('World War II at Sea: A Global History', 190243678) r_man = rater.create_non_fiction('The Society of Mind', 'Artificial Intelligence', 'Beginner', 671657135) r_man2 = rater.create_non_fiction('On Cooking', 'Culinary Arts', 'Expert', 131713272) r_pap = rater.create_novel('Pride and Prejudice', 'Jane Austen', 679783261) para = rater.create_novel('The Parasite', 'Arthur Conan Doyle', 809594374) #################################### USERS ################################## rater.add_user('RDSgmail', '*****@*****.**', user_books=[r_ww, r_pap, r_man]) rater.add_user('RDShotmail', '*****@*****.**') rater.add_user('RDSYahoo', '*****@*****.**') ############################### BOOKS TO USERS ############################## rater.add_book_to_user(r_man2, '*****@*****.**', 3)
from TomeRater import * Tome_Rater = TomeRater() Tome_Rater_Backup = Tome_Rater # Create some books with some tests: print("\nTest case: Few broken books created") book_error = Tome_Rater.create_book("Society of Mind", None) # ISBN missing - error book_error2 = Tome_Rater.create_book(12345, 12345) # Book name is not a string book1 = Tome_Rater.create_book("Society of Mind", 12345678) print(book1) book2 = Tome_Rater.create_book("Food for coders", 84372672, 2.54) print(book2) book3 = Tome_Rater.create_book("Loops and hoops", 385874323, 64.42) novel1 = Tome_Rater.create_novel("Alice In Wonderland", "Lewis Carroll", 12345) novel1.set_isbn(9781536831139) novel_error = Tome_Rater.create_novel( "Alice In Wonderland", "Lewis Carroll", 12345) # Same book twice, however ISBN is different and should be accepted nonfiction1 = Tome_Rater.create_non_fiction("Automate the Boring Stuff", "Python", "beginner", 1929452) nonfiction2 = Tome_Rater.create_non_fiction( "Computing Machinery and Intelligence", "AI", "advanced", 11111938) nonfiction3 = Tome_Rater.create_non_fiction("Computers", "Graphics", "turbo", 134451313, 34.55) novel2 = Tome_Rater.create_novel("The Diamond Age", "Neal Stephenson", 10101010) novel3 = Tome_Rater.create_novel("There Will Come Soft Rains", "Ray Bradbury", 10001000) novel4 = Tome_Rater.create_novel("The ABC's of programming", "John Doe",
from TomeRater import * import io import sys # ---------------------------------------------------------------------------- # TOME RATER (EQUALITY)(__eq__)(==)(COMPARE EQUALITY ON TWO TomeRater OBJECTS) # trap printout (START) ************************* trap = io.StringIO() sys.stdout = trap # OBJECT#1 tr1 = TomeRater() book1 = tr1.create_book("Society of Mind", 1234512345678) novel1 = tr1.create_novel("Alice In Wonderland", 1020304030201, "Lewis Carroll") nonfiction1 = tr1.create_non_fiction("Automate the Boring Stuff", 1234561929452, "Python", "beginner") tr1.add_user("Marvin Minsky", "*****@*****.**", books=[book1, novel1, nonfiction1]) # OBJECT#2 tr2 = TomeRater() book2 = tr2.create_book("Society of Mind", 1234512345678) novel2 = tr2.create_novel("Alice In Wonderland", 1020304030201, "Lewis Carroll")
from TomeRater import * Tome_Rater = TomeRater() #Create some books: book1 = Tome_Rater.create_book("Society of Mind", 12345678) #print(book1.title) #print(book1.isbn) novel1 = Tome_Rater.create_novel("Alice In Wonderland", "Lewis Carroll", 12345) novel1.set_isbn(9781536831139) #print(novel1.title) nonfiction1 = Tome_Rater.create_non_fiction("Automate the Boring Stuff", "Python", "beginner", 1929452) nonfiction2 = Tome_Rater.create_non_fiction( "Computing Machinery and Intelligence", "AI", "advanced", 11111938) novel2 = Tome_Rater.create_novel("The Diamond Age", "Neal Stephenson", 10101010) #print(novel2.title) novel3 = Tome_Rater.create_novel("There Will Come Soft Rains", "Ray Bradbury", 10001000) #print(novel3.title) #print("Finished Create Books") #Create users: Tome_Rater.add_user("Alan Turing", "*****@*****.**") Tome_Rater.add_user("David Marr", "*****@*****.**") #print(Tome_Rater.print_users()) #print("Finished Create Users") #Add a user with three books already read: Tome_Rater.add_user("Marvin Minsky", "*****@*****.**", user_books=[book1, novel1, nonfiction1])
from TomeRater import * Tome_Rater = TomeRater() #Create some books: book1 = Tome_Rater.create_book("Society of Mind", 12345678) novel1 = Tome_Rater.create_novel("Alice In Wonderland", "Lewis Carroll", 12345) novel1.set_isbn(9781536831139) nonfiction1 = Tome_Rater.create_non_fiction("Automate the Boring Stuff", "Python", "beginner", 1929452) nonfiction2 = Tome_Rater.create_non_fiction( "Computing Machinery and Intelligence", "AI", "advanced", 11111938) novel2 = Tome_Rater.create_novel("The Diamond Age", "Neal Stephenson", 10101010) novel3 = Tome_Rater.create_novel("There Will Come Soft Rains", "Ray Bradbury", 10001000) #Create users: Tome_Rater.add_user("Alan Turing", "*****@*****.**") Tome_Rater.add_user("David Marr", "*****@*****.**") #Add a user with three books already read: Tome_Rater.add_user("Marvin Minsky", "*****@*****.**", user_books=[book1, novel1, nonfiction1]) #Add books to a user one by one, with ratings: Tome_Rater.add_book_to_user(book1, "*****@*****.**", 1) Tome_Rater.add_book_to_user(novel1, "*****@*****.**", 3) Tome_Rater.add_book_to_user(nonfiction1, "*****@*****.**", 3) Tome_Rater.add_book_to_user(nonfiction2, "*****@*****.**", 4)
from TomeRater import * Tome_Rater = TomeRater() #Create some books: book1 = Tome_Rater.create_book("Society of Mind", 12345678) novel1 = Tome_Rater.create_novel("Alice In Wonderland", "Lewis Carroll", 12345) novel1.set_isbn(9781536831139) nonfiction1 = Tome_Rater.create_non_fiction("Automate the Boring Stuff", "Python", "beginner", 1929452) nonfiction2 = Tome_Rater.create_non_fiction( "Computing Machinery and Intelligence", "AI", "advanced", 11111938) novel2 = Tome_Rater.create_novel("The Diamond Age", "Neal Stephenson", 10101010) novel3 = Tome_Rater.create_novel("There Will Come Soft Rains", "Ray Bradbury", 10001000) # To test unique ISBN testbook = Tome_Rater.create_book("hoge", 12345678) #Create users: Tome_Rater.add_user("Alan Turing", "*****@*****.**") Tome_Rater.add_user("David Marr", "*****@*****.**") # To test same email Tome_Rater.add_user("hogehoge", "*****@*****.**") # To test invalid email address Tome_Rater.add_user("fuga", "fug@hogecom") #Add a user with three books already read: Tome_Rater.add_user("Marvin Minsky", "*****@*****.**", user_books=[book1, novel1, nonfiction1])
fiction4 = Fiction("Watch My Hand", 122999, "Nancy P. Magcian", 657) fiction5 = Fiction("Watch My Hand", 122999, "Umaq Umaqraq", 34500) print("Creating Non_Fiction") non_fiction1 = Non_Fiction("Python for Dummies", 111999, "Beginner", "Programming", 22.9) non_fiction2 = Non_Fiction("Python Cookbook", 111998, "Beginner", "Programming", 22.9) non_fiction3 = Non_Fiction("Python for Dummies", 111999, "Advanced", "Snakes", 35) print("Creating TomeRaters") tomerater1 = TomeRater() tomerater2 = TomeRater() tomerater3 = TomeRater() tomerater4 = TomeRater() print("Creating TomeRaterBook") tomeraterbook1 = tomerater1.create_book("That Book", 123908, 13) print("Creating TomeRaterNovel") tomeraternovel1 = tomerater1.create_novel("Untruth", "Jim Crowed", 122345, 90) print("Creating TomerRaterNon_Fiction") tomeraternon_fiction1 = tomerater1.create_non_fiction("Python for Dummies", "Beginner", "Programming", 111999, 22.9) print("Begin users testing\n") print("Testing user1 instance: Beatriz Rodriguez, [email protected], {}") print(user1.name, user1.email, user1.books, sep=" , ") print("Testing user1 string representation: User Beatriz Rodriguez with email [email protected] has read 0 book(s) with an average rating of None") print(user1) print("Testing equality of user1 and user2: False") print(user1 == user2) print("Testing equality of user1 and user3: True")
from TomeRater import * Tome_Rater = TomeRater() Tome_Rater2 = TomeRater() Tome_Rater3 = TomeRater() #Create some books: book1 = Tome_Rater.create_book("Society of Mind", 12345678, 11) novel1 = Tome_Rater.create_novel("Alice In Wonderland", "Lewis Carroll", 12345, 30) novel1.set_isbn(9781536831139) nonfiction1 = Tome_Rater.create_non_fiction("Automate the Boring Stuff", "Python", "beginner", 1929452, 20) nonfiction2 = Tome_Rater.create_non_fiction( "Computing Machinery and Intelligence", "AI", "advanced", 11111938, 50) novel2 = Tome_Rater.create_novel("The Diamond Age", "Neal Stephenson", 10101010, 13) novel3 = Tome_Rater.create_novel("There Will Come Soft Rains", "Ray Bradbury", 10001000, 22) #Create users: Tome_Rater.add_user("Alan Turing", "*****@*****.**") Tome_Rater.add_user("David Marr", "*****@*****.**") Tome_Rater.add_user("David", "*****@*****.**") Tome_Rater.add_user("Marr", "*****@*****.**") Tome_Rater.add_user("Troll Marr", "*****@*****.**") Tome_Rater.add_user("David Troll", "davidacomputation.org") #Add a user with three books already read: #Tome_Rater.add_user("Marvin Minsky", "*****@*****.**", user_books=[book1, novel1, nonfiction1]) Tome_Rater.add_user("Marvin Minsky", "*****@*****.**",
from TomeRater import * Tome_Rater = TomeRater() #Create some books: book1 = Tome_Rater.create_book("Society of Mind", 12345678, 50) book2 = Tome_Rater.create_book("Python for beginners", 6541354, 44) novel1 = Tome_Rater.create_novel("Alice In Wonderland", "Lewis Carroll", 12345, 30) novel1.set_isbn(9781536831139) nonfiction1 = Tome_Rater.create_non_fiction("Automate the Boring Stuff", "Python", "beginner", 1929452, 20) nonfiction2 = Tome_Rater.create_non_fiction( "Computing Machinery and Intelligence", "AI", "advanced", 11111938, 21) novel2 = Tome_Rater.create_novel("The Diamond Age", "Neal Stephenson", 10101010, 15) novel3 = Tome_Rater.create_novel("There Will Come Soft Rains", "Ray Bradbury", 10001000, 25) # # # # #Create users: Tome_Rater.add_user("Alan Turing", "*****@*****.**") Tome_Rater.add_user("David Marr", "*****@*****.**") # #add already exists user #Tome_Rater.add_user("Alan Turing", "*****@*****.**") #Add a user with three books already read: Tome_Rater.add_user("Marvin Minsky", "*****@*****.**", user_books=[book1, novel1, nonfiction1]) #
from TomeRater import * Tome_Rater = TomeRater() #Create some books: book1 = Tome_Rater.create_book("Society of Mind", 12345678) book2 = Tome_Rater.create_book("Second Book", 12345678) novel1 = Tome_Rater.create_novel("Alice In Wonderland", "Lewis Carroll", 12345) novel1.set_isbn(9781536831139) novel5 = Tome_Rater.create_novel("A Different Novel", "Lewis Carroll", 9781536831139) nonfiction1 = Tome_Rater.create_non_fiction("Automate the Boring Stuff", "Python", "beginner", 1929452) nonfiction3 = Tome_Rater.create_non_fiction("A Different Book", "Python", "beginner", 1929452) nonfiction2 = Tome_Rater.create_non_fiction("Computing Machinery and Intelligence", "AI", "advanced", 11111938) novel2 = Tome_Rater.create_novel("The Diamond Age", "Neal Stephenson", 10101010) novel3 = Tome_Rater.create_novel("There Will Come Soft Rains", "Ray Bradbury", 10001000) #Create users: Tome_Rater.add_user("Alan Turing", "*****@*****.**") Tome_Rater.add_user("David Marr", "*****@*****.**") Tome_Rater.add_user("David Marr", "*****@*****.**") #Add a user with three books already read: Tome_Rater.add_user("Marvin Minsky", "*****@*****.**", user_books=[book1, novel1, nonfiction1]) #Add books to a user one by one, with ratings: Tome_Rater.add_book_to_user(book1, "*****@*****.**", 1) Tome_Rater.add_book_to_user(novel1, "*****@*****.**", 3) Tome_Rater.add_book_to_user(nonfiction1, "*****@*****.**", 3) Tome_Rater.add_book_to_user(nonfiction2, "*****@*****.**", 4) Tome_Rater.add_book_to_user(novel3, "*****@*****.**", 1)
# TESTING (for TomeRater.py) # Dean Jones, Sep.15, 2018 # This file has been modified to run # The order of attributes is a bit different # The ISBN number (class) I added (requires 13 digits) # There where some inconsistencies (with the naming)(between the INSTRUCTIONS and THIS FILE) calling methods #CREATE OBJECT (TomeRater) tr = TomeRater() #CREATE BOOKS book1 = tr.create_book("Society of Mind", 1234512345678) #All (ISBN) (require 13 digits) novel1 = tr.create_novel("Alice In Wonderland", 1020304030201, "Lewis Carroll") #novel1 = Tome_Rater.create_novel("Alice In Wonderland", "Lewis Carroll", 12345) novel1.isbn.set_isbn(9781536831139) #novel1.set_isbn(9781536831139) nonfiction1 = tr.create_non_fiction("Automate the Boring Stuff", 1234561929452, "Python", "beginner") #nonfiction1 = Tome_Rater.create_non_fiction("Automate the Boring Stuff", "Python", "beginner", 1929452) nonfiction2 = tr.create_non_fiction("Computing Machinery and Intelligence", 1234511111938, "AI", "advanced") #nonfiction2 = Tome_Rater.create_non_fiction("Computing Machinery and Intelligence", "AI", "advanced", 11111938) novel2 = tr.create_novel("The Diamond Age", 1234510101010, "Neal Stephenson") #novel2 = Tome_Rater.create_novel("The Diamond Age", "Neal Stephenson", 10101010) novel3 = tr.create_novel("There Will Come Soft Rains", 1234510001000, "Ray Bradbury") #novel3 = Tome_Rater.create_novel("There Will Come Soft Rains", "Ray Bradbury", 10001000) #CREATE USERS
from TomeRater import * Tome_Rater = TomeRater() #Create some books: book1 = Tome_Rater.create_book("Society of Mind", 12345678) novel1 = Tome_Rater.create_novel("Alice In Wonderland", "Lewis Carroll", 12345) novel1.set_isbn(9781536831139) nonfiction1 = Tome_Rater.create_non_fiction("Automate the Boring Stuff", "Python", "beginner", 1929452) nonfiction2 = Tome_Rater.create_non_fiction( "Computing Machinery and Intelligence", "AI", "advanced", 11111938) novel2 = Tome_Rater.create_novel("The Diamond Age", "Neal Stephenson", 10101010) novel3 = Tome_Rater.create_novel("There Will Come Soft Rains", "Ray Bradbury", 10001000) book2 = Tome_Rater.create_book("Same ISBN", 1929452) #Create users: Tome_Rater.add_user("Alan Turing", "*****@*****.**") Tome_Rater.add_user("David Marr", "*****@*****.**") Tome_Rater.add_user("Same Email", "*****@*****.**") Tome_Rater.add_user("Wrong Email", "abc123.edu") #Add a user with three books already read: Tome_Rater.add_user("Marvin Minsky", "*****@*****.**", user_books=[book1, novel1, nonfiction1]) #Add books to a user one by one, with ratings: Tome_Rater.add_book_to_user(book1, "*****@*****.**", 1)
from TomeRater import * Tome_Rater = TomeRater() #Create some books: book1 = Tome_Rater.create_book("Society of Mind", 12345678) novel1 = Tome_Rater.create_novel("Alice In Wonderland", "Lewis Carroll", 12345) novel1.set_isbn(9781536831139) nonfiction1 = Tome_Rater.create_non_fiction("Automate the Boring Stuff", "Python", "beginner", 1929452, 25) nonfiction2 = Tome_Rater.create_non_fiction( "Computing Machinery and Intelligence", "AI", "advanced", 11111938, 30) novel2 = Tome_Rater.create_novel("The Diamond Age", "Neal Stephenson", 10101010, 50) novel3 = Tome_Rater.create_novel("There Will Come Soft Rains", "Ray Bradbury", 10001000) book_same_isbn = Tome_Rater.create_book("Book with same ISBN", 10101010) #Create users: Tome_Rater.add_user("Alan Turing", "*****@*****.**") Tome_Rater.add_user("David Marr", "*****@*****.**") #Add a user with three books already read: Tome_Rater.add_user("Marvin Minsky", "*****@*****.**", user_books=[book1, novel1, nonfiction1]) #Add books to a user one by one, with ratings: Tome_Rater.add_book_to_user(book1, "*****@*****.**", 1) Tome_Rater.add_book_to_user(novel1, "*****@*****.**", 3) Tome_Rater.add_book_to_user(nonfiction1, "*****@*****.**", 3)
from TomeRater import * Tome_Rater = TomeRater() #Create some books: book1 = Tome_Rater.create_book("Society of Mind", 12345678) novel1 = Tome_Rater.create_novel("Alice In Wonderland", "Lewis Carroll", 12345) # Removed to keep isbn's unique and unmutable # novel1.set_isbn(9781536831139) nonfiction1 = Tome_Rater.create_non_fiction("Automate the Boring Stuff", "Python", "beginner", 1929452) nonfiction2 = Tome_Rater.create_non_fiction( "Computing Machinery and Intelligence", "AI", "advanced", 11111938) novel2 = Tome_Rater.create_novel("The Diamond Age", "Neal Stephenson", 10101010) novel3 = Tome_Rater.create_novel("There Will Come Soft Rains", "Ray Bradbury", 10001000) #Create users: Tome_Rater.add_user("Alan Turing", "*****@*****.**") Tome_Rater.add_user("David Marr", "*****@*****.**") #Add a user with three books already read: Tome_Rater.add_user("Marvin Minsky", "*****@*****.**", user_books=[book1, novel1, nonfiction1]) #Add books to a user one by one, with ratings: Tome_Rater.add_book_to_user(book1, "*****@*****.**", 1) Tome_Rater.add_book_to_user(novel1, "*****@*****.**", 3) Tome_Rater.add_book_to_user(nonfiction1, "*****@*****.**", 3)
from TomeRater import * Tome_Rater = TomeRater() #Create some books: book1 = Tome_Rater.create_book("Society of Mind", 12345678) novel1 = Tome_Rater.create_novel("Alice In Wonderland", "Lewis Carroll", 12345) novel1.set_isbn(9781536831139) nonfiction1 = Tome_Rater.create_non_fiction("Automate the Boring Stuff", "Python", "beginner", 1929452) nonfiction2 = Tome_Rater.create_non_fiction("Computing Machinery and Intelligence", "AI", "advanced", 11111938) nonfiction3 = Tome_Rater.create_non_fiction("Obey The Testing Goat", "Python", "advanced", 1394098) novel2 = Tome_Rater.create_novel("The Diamond Age", "Neal Stephenson", 10101010) novel3 = Tome_Rater.create_novel("There Will Come Soft Rains", "Ray Bradbury", 10001000) #Create users: Tome_Rater.add_user("Alan Turing", "*****@*****.**") Tome_Rater.add_user("David Marr", "*****@*****.**") Tome_Rater.add_user("Mitchell Redekopp", "*****@*****.**") #Add a user with three books already read: Tome_Rater.add_user("Marvin Minsky", "*****@*****.**", user_books=[book1, novel1, nonfiction1]) #Add books to a user one by one, with ratings: Tome_Rater.add_book_to_user(book1, "*****@*****.**", 1) Tome_Rater.add_book_to_user(novel1, "*****@*****.**", 3) Tome_Rater.add_book_to_user(nonfiction1, "*****@*****.**", 3) Tome_Rater.add_book_to_user(nonfiction2, "*****@*****.**", 4) Tome_Rater.add_book_to_user(novel3, "*****@*****.**", 1)