Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialGilang Ilhami
12,045 Pointstesting Step in Model test
I was trying to do what kenneth and tried to test the Step in models,py
from django.test import TestCase
from django.utils import timezone
from .models import Course
from .models import Step
class CourseModelTests(TestCase):
def test_course_creation(self):
course = Course.objects.create(
title="Pyhton Reqular Expressions",
description="Learn to write regular expressions in Pyhton"
)
now = timezone.now()
self.assertLess(course.created_at, now)
class StepModelTests(TestCase):
def test_step_creation(self):
step = Step.objects.create(
title="Using the shell",
description="Learn how to use Python's shell to play with the language and help",
content=['Launch the shell with "python"',
'You can exit the shell by entering "exit" or "quit".',
'You can also exit the shell by pressing CTRL and D.']
order=0,
course=Course()
)
But of course, i got an error and i'm not quite sure why
File "/home/treehouse/workspace/learning_site/courses/tests.py", line 25
order=0,
^
SyntaxError: invalid syntax
----------------------------------------------------------------------
Ran 1 test in 0.001s
FAILED (errors=1)
Destroying test database for alias 'default'...
1 Answer
Umesh Ravji
42,386 PointsHi Gilang, you may have worked it out by now, but you are missing a comma (,) from the end of your list.
Gilang Ilhami
12,045 PointsGilang Ilhami
12,045 PointsHey umesh, lol yeah i did figured it out and yes i forgot, thanks anyway :)