"""Tests for wafer.user.models"""

from django.contrib.auth import get_user_model
from django.test import TestCase

import sys
PY2 = sys.version_info[0] == 2


class UserModelTestCase(TestCase):

    def test_str_method_issue192(self):
        """Test that str(user) works correctly"""
        create = get_user_model().objects.create_user
        user = create('test', 'test@example.com', 'test_pass')
        self.assertEqual(str(user.userprofile), 'test')
        user = create(u'tést', 'test@example.com', 'test_pass')
        if PY2:
            self.assertEqual(unicode(user.userprofile), u'tést')
        else:
            self.assertEqual(str(user.userprofile), u'tést')

"""Tests for wafer.user.models"""

from django.contrib.auth import get_user_model
from django.test import TestCase

import sys


class UserModelTestCase(TestCase):

    def test_str_method_issue192(self):
        """Test that str(user) works correctly"""
        create = get_user_model().objects.create_user
        user = create('test', 'test@example.com', 'test_pass')
        self.assertEqual(str(user.userprofile), 'test')
        user = create(u'tést', 'test@example.com', 'test_pass')
        self.assertEqual(str(user.userprofile), u'tést')

Remove python2 logic from test
Remove python2 logic from test

  """Tests for wafer.user.models"""
  
  from django.contrib.auth import get_user_model
  from django.test import TestCase
  
  import sys
- PY2 = sys.version_info[0] == 2
  
  
  class UserModelTestCase(TestCase):
  
      def test_str_method_issue192(self):
          """Test that str(user) works correctly"""
          create = get_user_model().objects.create_user
          user = create('test', 'test@example.com', 'test_pass')
          self.assertEqual(str(user.userprofile), 'test')
          user = create(u'tést', 'test@example.com', 'test_pass')
-         if PY2:
-             self.assertEqual(unicode(user.userprofile), u'tést')
-         else:
-             self.assertEqual(str(user.userprofile), u'tést')
+         self.assertEqual(str(user.userprofile), u'tést')
  
Remove python2 logic from test
## Code Before:
"""Tests for wafer.user.models"""

from django.contrib.auth import get_user_model
from django.test import TestCase

import sys
PY2 = sys.version_info[0] == 2


class UserModelTestCase(TestCase):

    def test_str_method_issue192(self):
        """Test that str(user) works correctly"""
        create = get_user_model().objects.create_user
        user = create('test', 'test@example.com', 'test_pass')
        self.assertEqual(str(user.userprofile), 'test')
        user = create(u'tést', 'test@example.com', 'test_pass')
        if PY2:
            self.assertEqual(unicode(user.userprofile), u'tést')
        else:
            self.assertEqual(str(user.userprofile), u'tést')

## Instruction:
Remove python2 logic from test
## Code After:
"""Tests for wafer.user.models"""

from django.contrib.auth import get_user_model
from django.test import TestCase

import sys


class UserModelTestCase(TestCase):

    def test_str_method_issue192(self):
        """Test that str(user) works correctly"""
        create = get_user_model().objects.create_user
        user = create('test', 'test@example.com', 'test_pass')
        self.assertEqual(str(user.userprofile), 'test')
        user = create(u'tést', 'test@example.com', 'test_pass')
        self.assertEqual(str(user.userprofile), u'tést')
