From the course: AI Pair Programming with GitHub Copilot

Unlock this course with a free trial

Join today to access over 24,900 courses taught by industry experts.

Test strategy and implementation with Chat Interface

Test strategy and implementation with Chat Interface - Github Copilot Tutorial

From the course: AI Pair Programming with GitHub Copilot

Test strategy and implementation with Chat Interface

- [Instructor] We've written our API, but code that's not tested is broken by design. That's been said by Jacob Kaplan-Moss, a famous contributor and one of the earlier founders of the Django Project. Let's write some tests. It's not always fun to write tests, but Copilot, like I said before, takes a bit of the effort out of it. So let's go to tests.py. And I want to go ahead and say this, imports for django_rest_framework tests. Great, that looks good. And class ExpenseTestCase. And I'm going to do something a little bit different. I'll start by making an import from .models import Expense. Thank you, Copilot. So after a while you sort of forget this. So when I set up, I want to do an Expense.object.create. And let's go ahead and give it some context. Remember, this is kind of a workaround. Now you'll see that it has a much easier time predicting what I want to do. So the reason this is kind of giving me a hard time here is, because of the quotes within quotes, this should sort of…

Contents