Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7417999
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T07:48:15+00:00 2026-05-29T07:48:15+00:00

how do i assert that F appears only once in ABCDEF? I used assertEqual

  • 0

how do i assert that F appears only once in ABCDEF?

I used assertEqual but django states that:

Traceback (most recent call last):
  File "/Users/jorrit/virtualenvs/voetbabbel/voetbabbel/apps/mass_mailer/tests.py", line 61, in test_create_mailing_list
    self.assertContains(p.user.email,"@", 1, status_code=200)
  File "/Library/Python/2.7/site-packages/django/test/testcases.py", line 419, in assertContains
    self.assertEqual(response.status_code, status_code,
AttributeError: 'unicode' object has no attribute 'status_code'

and my code in the test:

self.assertContains(p.user.email,"@", 1)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T07:48:16+00:00Added an answer on May 29, 2026 at 7:48 am

    As Chris says, this isn’t what assertContains is for. You can use one of the standard assertions:

    self.assertTrue(p.user.email.count('@') == 1)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have set up an asset host at assets.domain.com but it appears that cookies
I have a project that runs Python 2.7, PyGTK 2.24, and the most recent
I'd like to implement an assert that prevents compilation, rather than failing at runtime,
My test is trying to assert that a certain dal method was called, with
In NUnit, I can write either Assert.That(5, Is.EqualTo(5)); or Assert.AreEqual(5, 5); Is there any
So I see that Assert has dozens of methods that seem to do essentially
The best practice seems to be to use assert for a condition that should
I used to intern at a company that wrote SaaS asset management applications using
I have a script that compiles fine on Linux (Ubuntu 11.04), but not on
It appears to me that a strange phenomenon is occurring with inherited entities (TPT)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.