title: AssertionError: datetime.datetime(2017, 9, 20, 4, 43, 24, 206775, tzinfo=<UTC>) != '2017-09-19 08:47:51.807533'
body: <p>I run tests.py for tests, so I got an error</p>
  
  <pre><code>self.assertEqual(self.user1.regist_date, '2017-09-19 08:47:51.807533')
  AssertionError: datetime.datetime(2017, 9, 20, 4, 43, 24, 206775, tzinfo=&lt;UTC&gt;) != '2017-09-19 08:47:51.807533' 
  </code></pre>
  
  <p>I wrote in tests.py like</p>
  
  <pre><code>#coding:utf-8
  from django.test import TestCase
  from app.models import User
  
  # Create your tests here.
  class UserModelTests(TestCase):
      def setUp(self):
          self.user1 = User.objects.create(name='Tom', regist_date = '2017-09-19 08:47:51.807533',age=20)
  
      def test_user1_name(self):
          self.assertEqual(self.user1.name, 'Tom')
  
      def test_user1_regist_date(self):
          self.assertEqual(self.user1.regist_date, '2017-09-19 08:47:51.807533')
  
      def test_user1_age(self):
          self.assertEqual(self.user1.age, 20)
  </code></pre>
  
  <p>models.py is</p>
  
  <pre><code>class User(models.Model):
      name = models.CharField(max_length=200,null=True)
      regist_date = models.DateTimeField(auto_now=True)
      age = models.IntegerField(max_length=10,null=True)
  </code></pre>
  
  <p>I thought type of regist_date is datetime.datetime not string, so I rewrote
  setUp of tests.py is <code>self.user1 = User.objects.create(name='Tom', regist_date = datetime.datetime(2017, 9, 20, 4, 43, 24, 206775, tzinfo=&lt;UTC&gt;),age=20)</code>,so Can't assign to function call error happens.What is wrong in y method?How can I fix this?</p>
  
  <p>Traceback is</p>
  
  <pre><code>Traceback (most recent call last):
    File "/Users/uu121291/recomin/app/tests.py", line 17, in test_user1_regist_date
      self.assertEqual(self.user1.regist_date, datetime.strptime('2017-09-20 06:03:48.570498', '%Y-%m-%d %H:%M:%S.%f'))
  AssertionError: datetime.datetime(2017, 9, 20, 6, 7, 49, 51089, tzinfo=&lt;UTC&gt;) != datetime.datetime(2017, 9, 20, 6, 3, 48, 570498)
  
  ----------------------------------------------------------------------
  Ran 18 tests in 0.076s
  
  FAILED (failures=1)
  Destroying test database for alias 'default'...
  </code></pre>