stub

How to create a stub Python package for PyCharm?

How to create a stub Python package for PyCharm? Question: Let’s say we have a builtin module car. We have no autocomplete in PyCharm for it. It has interface: def getState(id, optional_id = None): pass def log(value): pass So, end usage would be: import car car.getState(5) car.log(‘Test’) How to create a package and join it …

Total answers: 1

Django unit testing with date/time-based objects

Django unit testing with date/time-based objects Question: Suppose I have the following Event model: from django.db import models import datetime class Event(models.Model): date_start = models.DateField() date_end = models.DateField() def is_over(self): return datetime.date.today() > self.date_end I want to test Event.is_over() by creating an Event that ends in the future (today + 1 or something), and stubbing …

Total answers: 7