<commit_before>import time
from django.test import TestCase
from django.db import IntegrityError
from objectset.models import ObjectSetError
from .models import Record, RecordSet, RecordSetObject, SimpleRecordSet


class SetTestCase(TestCase):
    fixtures = ['sets.json']

    def test_properties(self):
        s = SimpleRecordSet()
        self.assertEqual(s._set_object_class, SimpleRecordSet.records.through)
        self.assertEqual(s._object_class, Record)

        self.assertEqual(s._set_object_class_supported, False)

        self.assertEqual(s._set_object_rel, 'records')
        self.assertEqual(s._through_set_rel, 'simplerecordset')
        self.assertEqual(s._through_object_rel, 'record')

    def test_init(self):
        objs = [Record(pk=i) for i in xrange(5)]
        s = SimpleRecordSet(objs)
        self.assertEqual(s._pending, objs)
        s.save()
        self.assertTrue(isinstance(s._pending, s._object_class.objects.none().__class__))
        self.assertEqual(s.count, 5)
        self.assertEqual(s.pk, 1)

    def test_or(self):
        s1 = SimpleRecordSet([Record(pk=i) for i in xrange(1, 5)], save=True)
        s2 = SimpleRecordSet([Record(pk=i) for i in xrange(3, 7)], save=True)
        s3 = s1 | s2
        s3.save()

        self.assertEqual(sorted([o.pk for o in s3]), range(1, 7))<commit_msg>Remove renamed fixture<commit_after>import time
from django.test import TestCase
from django.db import IntegrityError
from objectset.models import ObjectSetError
from .models import Record, RecordSet, RecordSetObject, SimpleRecordSet


class SetTestCase(TestCase):
    def test_properties(self):
        s = SimpleRecordSet()
        self.assertEqual(s._set_object_class, SimpleRecordSet.records.through)
        self.assertEqual(s._object_class, Record)

        self.assertEqual(s._set_object_class_supported, False)

        self.assertEqual(s._set_object_rel, 'records')
        self.assertEqual(s._through_set_rel, 'simplerecordset')
        self.assertEqual(s._through_object_rel, 'record')

    def test_init(self):
        objs = [Record(pk=i) for i in xrange(5)]
        s = SimpleRecordSet(objs)
        self.assertEqual(s._pending, objs)
        s.save()
        self.assertTrue(isinstance(s._pending, s._object_class.objects.none().__class__))
        self.assertEqual(s.count, 5)
        self.assertEqual(s.pk, 1)

    def test_or(self):
        s1 = SimpleRecordSet([Record(pk=i) for i in xrange(1, 5)], save=True)
        s2 = SimpleRecordSet([Record(pk=i) for i in xrange(3, 7)], save=True)
        s3 = s1 | s2
        s3.save()

        self.assertEqual(sorted([o.pk for o in s3]), range(1, 7))
{'fraction_non_alphanumeric': 0.11417769376181475, 'fraction_numerical': 0.012098298676748583, 'mean_word_length': 3.351973684210526, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6668167', 'n_tokens_mistral': 852, 'n_tokens_neox': 822, 'n_words': 177}