# Path: nosedjangotests/polls/models.py
# class Choice(models.Model):
#     content_type = models.ForeignKey('contenttypes.ContentType')
#     object_id = models.PositiveIntegerField()
#     poll = GenericForeignKey('content_type', 'object_id')
# 
#     choice = models.CharField(max_length=200)
#     votes = models.IntegerField(default=0)
# 
#     @atomic
#     def reset(self):
#         self.votes = 0
#         self.save()
# 
# class Poll(models.Model):
#     question = models.CharField(max_length=200)
#     pub_date = models.DateTimeField('date published')
# 
#     @atomic
#     def reset(self):
#         self.question = ""
#         self.save()


from contextlib import contextmanager
from datetime import datetime
    from django.db.transaction import atomic
    from django.db.transaction import commit_on_success as atomic
from django.db import transaction
from django.db.transaction import TransactionManagementError
from django.test import TestCase
from nose.plugins.skip import SkipTest
from nosedjangotests.polls.models import Choice, Poll
import django
    transaction.set_autocommit(old_value)


class FixtureBleedThroughTestCase(TestCase):
    use_transaction_isolation = True

    fixtures = [
        'polls1.json',
        'choices.json',
    ]

    def test_AAA_change_poll_question(self):
        if django.VERSION < (1, 7):
            raise SkipTest('This test is only an issue in django 1.8+')
        poll = Poll.objects.get()
        poll.question = 'What does the fox say?'

        # If we are using transaction isolation, then using atomic/autocommit
        # is invalid.
        if self.use_transaction_isolation:
            with self.assertRaises(TransactionManagementError):
                with set_autocommit(True):
                    with atomic():
                        poll.save()
        else:
            with set_autocommit(True):
                with atomic():
                    poll.save()

    def test_BBB_poll_question_is_what_is_in_the_fixture(self):

# Path: nosedjangotests/polls/models.py
# class Choice(models.Model):
#     content_type = models.ForeignKey('contenttypes.ContentType')
#     object_id = models.PositiveIntegerField()
#     poll = GenericForeignKey('content_type', 'object_id')
# 
#     choice = models.CharField(max_length=200)
#     votes = models.IntegerField(default=0)
# 
#     @atomic
#     def reset(self):
#         self.votes = 0
#         self.save()
# 
# class Poll(models.Model):
#     question = models.CharField(max_length=200)
#     pub_date = models.DateTimeField('date published')
# 
#     @atomic
#     def reset(self):
#         self.question = ""
#         self.save()


# Path: nosedjangotests/polls/tests/test0.py
from contextlib import contextmanager
from datetime import datetime
    from django.db.transaction import atomic
    from django.db.transaction import commit_on_success as atomic
from django.db import transaction
from django.db.transaction import TransactionManagementError
from django.test import TestCase
from nose.plugins.skip import SkipTest
from nosedjangotests.polls.models import Choice, Poll
import django

    transaction.set_autocommit(old_value)


class FixtureBleedThroughTestCase(TestCase):
    use_transaction_isolation = True

    fixtures = [
        'polls1.json',
        'choices.json',
    ]

    def test_AAA_change_poll_question(self):
        if django.VERSION < (1, 7):
            raise SkipTest('This test is only an issue in django 1.8+')
        poll = Poll.objects.get()
        poll.question = 'What does the fox say?'

        # If we are using transaction isolation, then using atomic/autocommit
        # is invalid.
        if self.use_transaction_isolation:
            with self.assertRaises(TransactionManagementError):
                with set_autocommit(True):
                    with atomic():
                        poll.save()
        else:
            with set_autocommit(True):
                with atomic():
                    poll.save()

    def test_BBB_poll_question_is_what_is_in_the_fixture(self):

        poll = Poll.objects.get()