예제 #1
0
def main():
 name = "Gibson L-5 CES"
 year = 1922
 cost = 16035.40

 guitar = Guitar(name, year, cost)
 other = Guitar("Another Guitar", 2012, 1512.9)

 print("{} get_age() - Expected(). Got {}".format(guitar, name, 95, guitar.get_age()))
 print("{} get_age() - Expected(). Got {}".format(other, name, 5, other.get_age()))
 print()
 print("{} is_vintage() - Expected {}. Got {}". format(guitar.name,True, guitar.is_vintage()))
 print("{} is_vintage() - Expected {}. Got {}". format(other.name,False, other.is_vintage()))
 print()
예제 #2
0
def run_tests():
    """Tests for Guitar class."""
    name = "Gibson L-5 CES"
    year = 1922
    cost = 16035.40

    guitar = Guitar(name, year, cost)
    other = Guitar("Another Guitar", 2012, 1512.9)

    print("{} get_age() - Expected {}. Got {}".format(guitar.name,
                                                      CURRENT_YEAR - year,
                                                      guitar.get_age()))
    print("{} get_age() - Expected {}. Got {}".format(other.name,
                                                      CURRENT_YEAR - year,
                                                      other.get_age()))
    print()
    print("{} is_vintage() - Expected {}. Got {}".format(
        guitar.name, True, guitar.is_vintage()))
    print("{} is_vintage() - Expected {}. Got {}".format(
        other.name, False, other.is_vintage()))
예제 #3
0
from Prac_6.guitar import Guitar

guitar = Guitar("Gibson L-5 CES", 1922, 16035.40)
other_guitar = Guitar("Another Guitar", 2012, 1500)

print("{} get_age() - Expected 96. Got {}".format(guitar.name,
                                                  guitar.get_age()))

print("{} get_age() - Expected 6. Got {}".format(other_guitar.name,
                                                 other_guitar.get_age()))

print()
print("{} is_vintage() - Expected True. Got {}".format(guitar.name,
                                                       guitar.is_vintage()))
print("{} is_vintage() - Expected False. Got {}".format(
    other_guitar.name, other_guitar.is_vintage()))