コード例 #1
0
def main():
    fender = Guitar("Fender", 1922, 5000)
    Air = Guitar("Air", 2011, 1)
    print(Guitar.get_age(fender))
    print(Guitar.get_age(Air))
    print(Guitar.is_vintage(fender))
    print(Guitar.is_vintage(Air))
コード例 #2
0
def main():
    guitar_one = Guitar("Gibson L-5 Ces", 1922, 10000)
    guitar_two = Guitar("Second Guitar", 2011, 50)

    print("{}\n{}".format(guitar_one, guitar_two))

    print("get_age() - Expected 94. Got {}".format(guitar_one.get_age()))
    print("get_age() - Expected 5. Got {}".format(guitar_two.get_age()))

    print("is_vintage() - Expected True. Got {}".format(guitar_one.is_vintage()))
    print("is_vintage() - Expected False. Got {}".format(guitar_two.is_vintage()))
コード例 #3
0
def main():
    guitar1 = Guitar("Gibson L-5 CES", 1922, 16035.4)
    guitar2 = Guitar("Fender Eric Clapton Stratocaster®", 1991, 3599)

    print(guitar1)
    #guitar1.get_age(age)

    print("get_age() - Expected 95. Got {}".format(guitar1.get_age()))
    print("get_age() - Expected 26. Got {}".format(guitar2.get_age()))

    age1 = guitar1.get_age()
    age2 = guitar2.get_age()

    print("is_vintage() - Expected True. Got {}".format(
        guitar1.is_vintage(age1)))
    print("is_vintage() - Expected False. Got {}".format(
        guitar2.is_vintage(age2)))
コード例 #4
0
from Prac07.guitar import Guitar

guitar1 = Guitar("Gibson L-5 CES", 1922, 16035.40)

print(guitar1)

print(guitar1.get_age())
print(guitar1.is_vintage())
コード例 #5
0
ファイル: guitar_test.py プロジェクト: MaxDunsmore/CP1404
from Prac07.guitar import Guitar

guitar = Guitar("test", 1000, 300)
guitar2 = Guitar("test", 2010, 30)

print("get_age() - Expected {}. Got {}.".format(2017 - guitar.year,
                                                guitar.get_age()))
print("get_age() - Expected {}. Got {}.".format(2017 - guitar2.year,
                                                guitar2.get_age()))

print("is_vintage() - Expected {}. Got {}.".format(
    True if 2017 - guitar.year >= 50 else False, guitar.is_vintage()))
print("is_vintage() - Expected {}. Got {}.".format(
    True if 2017 - guitar2.year >= 50 else False, guitar2.is_vintage()))