What does mean 'f' ? It is not imported or instanced..what is it?
Il dom 21 ott 2018, 06:24 Tim Vogt (Tim Vogt) <timtvogt@gmail.com> ha scritto:
I try to make a test with has an error--any suggestions?timexpected_author = f'{post.author}^SyntaxError: EOL while scanning string literal----------------------------------------------------------------------Ran 1 test in 0.000sFAILED (errors=1)Destroying test database for alias 'default'...MacBook-Pro-15-Officerebel:blogapi timvogt$from django.test import TestCasefrom django.contrib.auth.models import Userfrom .models import Postclass BlogTests(TestCase):@classmethoddef setUpTestData(cls):#Create a usertestuser1 = User.objects.create_user(username='testuser1', password='abc123')testuser1.save()# Create a blog posttest_post = Post.objects.create(author=testuser1, title='Blog title', body='Body content...')test_post.save()def test_blog_content(self):post = Post.objects.get(id=1)expected_author = f'{post.author}'expected_title = f'{post.title}'expected_body = f'{post.body}'self.assertEquals(expected_author, 'testuser1')self.assertEquals(expected_title,'Blog title')self.assertEquals(expected_body, 'Body content ...')
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/FCBEF0A0-EDB1-4842-BB4E-42249F3F48EB%40gmail.com.
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CA%2BhSpwe4fVqaHU6JWvoc6%2B3D9RFF7beXhGzHu%3DaGs0Ez5fggtw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment