Category : unit-testing

I can’t seem to figure out why my unittest is not running. enter image description here I am trying to test the methods in calculator class: class Calculator(): def __init__(self): pass def is_peak(self, start_time: str): time = start_time.split(‘:’) # Extracts the hour character from the string hour = time[0] int_hour = int(hour) if 6 <= ..

Read more

I need to create a unit test that mock a REST API failure call, with a side effect of returning an UnauthorizedAccess exception, from the PyActiveResource project (https://github.com/Shopify/pyactiveresource) and store it in the DB. What I’ve create so far worked and I’ve got the desired returned side effect. Then, I catch it on the function ..

Read more

My webscraper should fill out the attributes for the following object: class Item: def __init__(self, date_retrived, title, contributors, format, is_hold, item_date, status, branch): self.date_retrieved = date_retrived self.title = title self.contributors = contributors self.format = format self.is_hold = is_hold self.status = status self.item_date = item_date self.branch = branch Would it be "bad in style" to test ..

Read more