Ejemplo n.º 1
0
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", 10101010,
    "Neal Stephenson")  # changed order of parameters to match method
novel3 = Tome_Rater.create_novel(
    "There Will Come Soft Rains", 10001000,
    "Ray Bradbury")  # changed order of parameters to match method

#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",
                    "*****@*****.**",
                    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)
Ejemplo n.º 2
0
from TomeRater import *

Tome_Rater = TomeRater()

#Create some books:
book1 = Tome_Rater.create_book("Society of Mind", 12345678, 5.65)
novel1 = Tome_Rater.create_novel("Alice In Wonderland", "Lewis Carroll", 12345,
                                 6.25)
novel1.set_isbn(9781536831139)
nonfiction1 = Tome_Rater.create_non_fiction("Automate the Boring Stuff",
                                            "Python", "beginner", 1929452,
                                            12.10)
nonfiction2 = Tome_Rater.create_non_fiction(
    "Computing Machinery and Intelligence", "AI", "advanced", 11111938, 8.00)
novel2 = Tome_Rater.create_novel("The Diamond Age", "Neal Stephenson",
                                 10101010)
novel3 = Tome_Rater.create_novel("There Will Come Soft Rains", "Ray Bradbury",
                                 10001000, 4.70)
novel4 = Tome_Rater.create_novel("Hallelujah", "John Doe Jr", 10001000, 7.75)

#Create users:
Tome_Rater.add_user("Alan Turing", "*****@*****.**")
Tome_Rater.add_user("David Marr", "*****@*****.**")
Tome_Rater.add_user("David Double", "*****@*****.**")

#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:
Ejemplo n.º 3
0
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",
Ejemplo n.º 4
0
from TomeRater import *

Tome_Rater = TomeRater()

#Create some books:
book1 = Tome_Rater.create_book("Society of Mind", 1234567891, 34.00)
novel1 = Tome_Rater.create_novel("Alice In Wonderland", "Lewis Carroll",
                                 8767954325, 45.50)
novel1.set_isbn(9781536831139)
nonfiction1 = Tome_Rater.create_non_fiction("Automate the Boring Stuff",
                                            "Python", "beginner", 1929452090,
                                            22.50)
nonfiction2 = Tome_Rater.create_non_fiction(
    "Computing Machinery and Intelligence", "AI", "advanced", 1111193899,
    110.00)
novel2 = Tome_Rater.create_novel("The Diamond Age", "Neal Stephenson",
                                 1010101010, 15.25)
novel3 = Tome_Rater.create_novel("There Will Come Soft Rains", "Ray Bradbury",
                                 1000100011, 21.50)

#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)
Ejemplo n.º 5
0
from TomeRater import *

Tome_Rater = TomeRater()

#Create some books:
#book1 = Tome_Rater.create_book("Society of Mind", 12345678,14.28)
novel51 = Tome_Rater.create_novel("Alice In Wonderland", "Lewis Carroll", 12345,72.66)
nonfiction1 = Tome_Rater.create_non_fiction("Automate the Boring Stuff", "Python", "beginner", 1929452,26.31)
nonfiction2 = Tome_Rater.create_non_fiction("Computing Machinery and Intelligence", "AI", "advanced", 11111938,53.74)
novel1 = Tome_Rater.create_novel('To Kill a Mockingbird','Harper Lee',73532,11.67)
novel2 = Tome_Rater.create_novel('1984','George Orwell',95454,19.72)
novel3 = Tome_Rater.create_novel('Harry Potter and the Sorcerer\'s Stone','J.K. Rowling',54836,23.02)
novel4 = Tome_Rater.create_novel('The Hunger Games','Suzanne Collins',22533,12.76)
novel5 = Tome_Rater.create_novel('The Book Thief','Markus Zusak',48886,28.95)
novel6 = Tome_Rater.create_novel('Harry Potter and the Deathly Hallows','J.K. Rowling',24793,23.09)
novel7 = Tome_Rater.create_novel('Pride and Prejudice','Jane Austen',69705,20.74)
novel8 = Tome_Rater.create_novel('Ender\'s Game','Orson Scott Card',88968,23.91)
novel9 = Tome_Rater.create_novel('East of Eden','John Steinbeck',50844,16.82)
novel10 = Tome_Rater.create_novel('Animal Farm','George Orwell',92240,24.59)
novel11 = Tome_Rater.create_novel('The Hobbit','J.R.R. Tolkien',47992,22.82)
novel12 = Tome_Rater.create_novel('A Game of Thrones','George R.R. Martin',64597,14.60)
novel13 = Tome_Rater.create_novel('A Tree Grows in Brooklyn','Betty Smith',78480,13.93)
novel14 = Tome_Rater.create_novel('Harry Potter and the Prisoner of Azkaban','J.K. Rowling',55909,10.19)
novel15 = Tome_Rater.create_novel('The Kite Runner','Khaled Hosseini',46017,25.56)
novel16 = Tome_Rater.create_novel('The Stand','Stephen King',76292,27.61)
novel17 = Tome_Rater.create_novel('Ready Player One','Ernest Cline',57358,24.74)
novel18 = Tome_Rater.create_novel('The Help','Kathryn Stockett',38796,26.95)
novel19 = Tome_Rater.create_novel('The Lightning Thief','Rick Riordan',72634,13.91)
novel20 = Tome_Rater.create_novel('Harry Potter and the Order of the Phoenix','J.K. Rowling',75416,14.16)
novel21 = Tome_Rater.create_novel('The Odyssey','Homer',12560,11.12)
novel22 = Tome_Rater.create_novel('Crime and Punishment','Fyodor Dostoyevsky',51040,15.18)
Ejemplo n.º 6
0
from TomeRater import *

Tome_Rater = TomeRater()

#Create some books:
#modified to add price as an argument
book1 = Tome_Rater.create_book("Society of Mind", 12345678, 9.99)
novel1 = Tome_Rater.create_novel("Alice In Wonderland", 12345, 5.99,
                                 "Lewis Carroll")
novel1.set_isbn(9781536831139)
nonfiction1 = Tome_Rater.create_non_fiction("Automate the Boring Stuff",
                                            1929452, 10.99, "Python",
                                            "beginner")
nonfiction2 = Tome_Rater.create_non_fiction(
    "Computing Machinery and Intelligence", 11111938, 11.99, "AI", "advanced")
novel2 = Tome_Rater.create_novel("The Diamond Age", 10101010, 5.99,
                                 "Neal Stephenson")
novel3 = Tome_Rater.create_novel("There Will Come Soft Rains", 10001000, 7,
                                 "Ray Bradbury")

#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, "*****@*****.**")
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")
nonfiction2 = tr2.create_non_fiction("Automate the Boring Stuff",
                                     1234561929452, "Python", "beginner")
Ejemplo n.º 8
0
from TomeRater import *

Tome_Rater = TomeRater()

#Create some books:
book1 = Tome_Rater.create_book("Society of Mind", 12345678, 1.5)
novel1 = Tome_Rater.create_novel("Alice In Wonderland", "Lewis Carroll", 12345,
                                 1.99)
novel1.set_isbn(9781536831139)
nonfiction1 = Tome_Rater.create_non_fiction("Automate the Boring Stuff",
                                            "Python", "beginner", 1929452, 8)
nonfiction2 = Tome_Rater.create_non_fiction(
    "Computing Machinery and Intelligence", "AI", "advanced", 11111938, 9.95)
novel2 = Tome_Rater.create_novel("The Diamond Age", "Neal Stephenson",
                                 10101010, 14)
novel3 = Tome_Rater.create_novel("There Will Come Soft Rains", "Ray Bradbury",
                                 10001000, 18.99)
novel4 = Tome_Rater.create_novel("This Book Has A Duplicate ISBN",
                                 "Bogus Fakery", 10001000, 22.00)
novel5 = Tome_Rater.create_novel(
    "The Never Read Book - The Price of Being Too Expensive",
    "Greedy McMoneybags", 987654321, 100)

#Create users:
Tome_Rater.add_user("Alan Turing", "*****@*****.**")
Tome_Rater.add_user("David Marr", "*****@*****.**")
#intentionally bogus email address for checking function
Tome_Rater.add_user("David Marr", "davidcomputation.org")
#intentionally bogus email address for checking function
Tome_Rater.add_user("David Marr", "*****@*****.**")
Ejemplo n.º 9
0
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)
Ejemplo n.º 10
0
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)
rater.add_book_to_user(r_man2, '*****@*****.**', 4)
rater.add_book_to_user(para, '*****@*****.**', 4)
rater.add_book_to_user(para, '*****@*****.**', 3)

#############################################################################
print('\n--------------------- Error Handling Checks ----------------------')
Ejemplo n.º 11
0
from TomeRater import *

Tome_Rater = TomeRater()

#Create some books:
book1 = Tome_Rater.create_book("Society of Mind", 12345678)
print(book1)
novel1 = Tome_Rater.create_novel("Alice In Wonderland", "Lewis Carroll", 12345)
print(novel1)
novel1.set_isbn(9781536831139)
print(novel1)
nonfiction1 = Tome_Rater.create_non_fiction("Automate the Boring Stuff",
                                            "Python", "beginner", 1929452)
print(nonfiction1)
nonfiction2 = Tome_Rater.create_non_fiction(
    "Computing Machinery and Intelligence", "AI", "advanced", 11111938)
print(nonfiction2)
novel2 = Tome_Rater.create_novel("The Diamond Age", "Neal Stephenson",
                                 10101010)
novel3 = Tome_Rater.create_novel("There Will Come Soft Rains", "Ray Bradbury",
                                 10001000)
new_novel = Tome_Rater.create_novel("Jurassic Park", "Michael Crichton",
                                    1234567)
print(novel2, novel3, new_novel)
# #Create users:
Tome_Rater.add_user("Alan Turing", "*****@*****.**")
# print(self.Users)
Tome_Rater.add_user("David Marr", "*****@*****.**")
#
# #Add a user with three books already read:
Tome_Rater.add_user("Marvin Minsky",
Ejemplo n.º 12
0
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)
nonfiction2 = Tome_Rater.create_non_fiction(
    "Computing Machinery and Intelligence", "AI", "advanced", 11111938)
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)
Ejemplo n.º 13
0
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)
Ejemplo n.º 14
0
# 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
tr.add_user("Alan Turing", "*****@*****.**")
Ejemplo n.º 15
0
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")
print(user1 == user3)
print("Testing get_email user1: [email protected]")
print(user1.get_email())
Ejemplo n.º 16
0
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)
Ejemplo n.º 17
0
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)
novel4 = Tome_Rater.create_novel("The Hobbit", "J.R.R. Tolkien", 10002001)
novel5 = Tome_Rater.create_novel("The Fellowship of the Ring", "J.R.R. Tolkien", 10002002)
novel6 = Tome_Rater.create_novel("The Two Towers", "J.R.R. Tolkien", 10002003)
novel7 = Tome_Rater.create_novel("The Return of the King", "J.R.R. Tolkien", 10002004)

# Create users:
Tome_Rater.add_user("Alan Turing", "*****@*****.**")
Tome_Rater.add_user("David Marr", "*****@*****.**")
Tome_Rater.add_user("Alice Test", "*****@*****.**")
Tome_Rater.add_user("Bob Test", "*****@*****.**")
Tome_Rater.add_user("Carly Test", "*****@*****.**")

# 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)
Ejemplo n.º 18
0
			if book.get_average_rating() > high[1]:
				high = [book, book.get_average_rating()]
		return high
	
	def most_positive_user(self):
		high = ["",-1000]
		for user in self.users.values():
			if user.get_average_rating() > high[1]:
				high = [user, user.get_average_rating()]
		return high
	
	

#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)
Ejemplo n.º 19
0
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)