title: Python assert is lying? 1 != 1
body: <p>I've a piece of code </p>
  
  <pre><code>   assert (len(max_test_scores) != 1), \
            "Internal error - migration 0011 - module Programs." \
            " Please contact with developers - " + str(len(max_test_scores))
  </code></pre>
  
  <p>And during execution this code, I've got an assertion error:</p>
  
  <blockquote>
    <p>AssertionError: Internal error - migration 0011 - module Programs. Please contact with  developers - 1</p>
  </blockquote>
  
  <p>So 1 != 1 ? </p>
  
  <p>I was searching, googling and thinking how this can happend, but have no idea. Here is code with it's context</p>
  
  <pre><code>def forwards(self, orm):
      problems_and_groups = orm.Test.objects \
              .values('problem', 'group').distinct()
  
      problems_instances_and_groups = []
      for pi in orm['contests.ProblemInstance'].objects.all():
          for pg in problems_and_groups:
              if pi.problem.pk == pg['problem']:
                  problems_instances_and_groups \
                          .append({'problem_instance': pi.pk,
                                   'group': pg['group']})
  
      count = len(problems_instances_and_groups)
      num = 0
      update_every = max(1, count / 20)
      pb = ProgressBar(count)
      print "Migrating %d groups" % count
      for pig in problems_instances_and_groups:
          if num % update_every == 0:
              pb.update(num)
          num += 1
  
          submissions = orm['contests.Submission'].objects \
                  .filter(problem_instance = pig['problem_instance']) \
                  .values('pk')
  
          print submissions
  
          submission_reports = orm['contests.SubmissionReport'].objects \
                  .filter(submission__in = submissions).values('pk')
  
          print submission_reports
  
          test_reports = orm.TestReport.objects \
                  .filter(test_group = pig['group'],
                          submission_report__in = submission_reports)
  
          max_score = None
  
          max_test_scores = frozenset(test_report.test.max_score
                  for test_report in test_reports)
  
          assert (len(max_test_scores) != 1), \
                  "Internal error - migration 0011 - module Programs." \
                  " Please contact with developers - " + str(len(max_test_scores))
  
          max_score = ScoreValue(list(max_test_scores)[0])
  
          GroupReport.filter(test_group=pig['group'],
                  submission_report__in = submission_reports) \
                  .update(max_score=max_score)
  </code></pre>