from models import Advertiser from models.ad import Ad if __name__ == '__main__': advertiser1 = Advertiser('name1') advertiser2 = Advertiser('name2') ad1 = Ad(title='title1', image_url='image-url1', link='link1', advertiser=advertiser1) ad2 = Ad(title='title2', image_url='image-url2', link='link2', advertiser=advertiser2) ad2.describe_me() advertiser1.describe_me() ad1.inc_views() ad1.inc_views() ad1.inc_views() ad1.inc_views() ad2.inc_views() ad1.inc_clicks() ad1.inc_clicks() ad2.inc_clicks() print(advertiser2.get_name()) advertiser2.set_name('new name') print(advertiser2.get_name()) print(ad1.get_clicks()) print(advertiser2.get_clicks()) print(Advertiser.get_total_clicks()) print(Advertiser.help())
base_advertising = BaseAdvertising() advertiser_1 = Advertiser(1, 'name1') advertiser_2 = Advertiser(2, 'name2') ad_1 = Ad(1, 'title1', 'img_url1', 'link', advertiser_1) ad_2 = Ad(2, 'title1', 'img_url1', 'link', advertiser_2) print(base_advertising.describe_me(), ad_2.describe_me(), advertiser_1.describe_me(), sep='\n') ad_1.inc_views() ad_1.inc_views() ad_1.inc_views() ad_1.inc_views() ad_2.inc_views() ad_1.inc_clicks() ad_1.inc_clicks() ad_2.inc_clicks() print(advertiser_2.get_name()) advertiser_2.set_name('new name') print(advertiser_2.get_name(), ad_1.get_clicks(), advertiser_2.get_clicks(), Advertiser.get_total_clicks(), Advertiser.help(), sep='\n')