Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Need to do unittesting on this file, can I get help with how to make a new file plus some unittesting done to see what
Need to do unittesting on this file, can I get help with how to make a new file plus some unittesting done to see what is needed, thank you
this is need to be done in python
from abc import ABC from datetime import datetime from datetime import time from AudioFile import AudioFile class Podcast(AudioFile, ABC): def __init__(self, title: str, artist: str, runtime: str, rating: int, series: str, season: str = None, number: int = None) -> None: super().__init__(title, artist, runtime, rating) self._series = series self._season = season self._episode_number = number self._episode_date = datetime.now() self._progress = time(0, 5, 30) Podcast._doublecheck(title, artist, runtime, rating, series, season, number, self._episode_date) @staticmethod def _doublecheck(title: str, artist: str, runtime: str, rating: int, series: str, season: str, number: int, episode_date) -> None: if not ((type(title)) or (type(artist)) or (type(runtime)) or((type(season) != str) or (type(rating) != int) and type(season) is None) ((type(number) != int) and type(number) is None)): if type(episode_date) != datetime: raise ValueError('Invalid date') else: raise ValueError('Values must be a string.') def get_desc(self) -> str: if (self._season is not None) and (self._episode_number is not None): song_desc = '{}: {}, {}, Season {} Episode {} ({})' .format(self._series, self._title, self._episode_date, self._season, self._episode_number, self._runtime) return song_desc def meta_data(self) -> dict: if (self._season is not None) and (self._episode_number is not None): song_dict = {'title': self._title, 'artist': self._artist, 'date_added': self._usage.date_added, 'runtime': self._runtime, 'pathname': self._filepath, 'filename': self._filename, 'play_count': self._usage.play_count, 'last_played': self._usage.last_played, 'rating': self._human_rating, 'series': self._series, 'season': self._season, 'episode_number': self._episode_number} return song_dict @property def progress_area(self) -> time: return self._progress @progress_area.setter def progress_area(self, progress_area: str) -> None: try: progress_area = datetime.strptime(progress_area, '%H:%M:%S') self._progress = '%0.2d:%0.2d:%0.2d' % (progress_area.hour, progress_area.minute, progress_area.second) except: raise ValueError
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started