Why did you say that? I'm using django 2.2 and f strings are indeed supported.
Sincerely yours, Joel G Mathew On Sun, 21 Oct 2018 at 18:05, Motaz Hejaze <[email protected]> wrote: > > f'{}' is not supported > > On Sun, Oct 21, 2018 at 2:29 PM Joel <[email protected]> wrote: >> >> What is your version of python? f strings were introduced in 3.6 >> >> On Sun, 21 Oct, 2018, 9:54 AM Tim Vogt (Tim Vogt), <[email protected]> >> wrote: >>> >>> I try to make a test with has an error >>> any suggestions? >>> tim >>> >>> >>> expected_author = f'{post.author} >>> ^ >>> SyntaxError: EOL while scanning string literal >>> >>> >>> ---------------------------------------------------------------------- >>> Ran 1 test in 0.000s >>> >>> FAILED (errors=1) >>> Destroying test database for alias 'default'... >>> MacBook-Pro-15-Officerebel:blogapi timvogt$ >>> >>> >>> from django.test import TestCase >>> from django.contrib.auth.models import User >>> >>> from .models import Post >>> >>> class BlogTests(TestCase): >>> >>> @classmethod >>> def setUpTestData(cls): >>> #Create a user >>> testuser1 = User.objects.create_user( >>> username='testuser1', password='abc123') >>> testuser1.save() >>> >>> # Create a blog post >>> test_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 [email protected]. >>> To post to this group, send email to [email protected]. >>> 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 [email protected]. >> To post to this group, send email to [email protected]. >> 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/CAA%3Diw_8VU9J9QGUz_LNGjBRCQSGo0rpJ1FTtY5H00U_Di_7oiw%40mail.gmail.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 [email protected]. > To post to this group, send email to [email protected]. > 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/CAHV4E-d4qHggazeGzrZJWdf1_Z766SoiJhqXDwizP5Vuox0nVQ%40mail.gmail.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 [email protected]. To post to this group, send email to [email protected]. 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/CAA%3Diw_98qeuc4MM4_HdUHJzjfJXGxpZGMmeauOMQXaaon-KSkA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.

