<commit_before>from django.test import TestCase
from .models import Rental


class RentalTestCase(TestCase):

    def test_str(self):
        rental = Rental(name='Fitnessflow')
        self.assertEqual(rental.__str__(), 'Rental by Fitnessflow')<commit_msg>Add test for constraint<commit_after>import datetime
from django.test import TestCase
from django.core.exceptions import ValidationError
from .models import Rental


class RentalTestCase(TestCase):

    def test_clean__valid_rental(self):
        rental = Rental(
            start_date=datetime.datetime(2017, 3, 15),
            return_date=datetime.datetime(2017, 3, 17)
        )
        rental.clean()

    def test_clean__same_dates(self):
        rental = Rental(
            start_date=datetime.datetime(2017, 3, 15),
            return_date=datetime.datetime(2017, 3, 15)
        )
        rental.clean()

    def test_clean__invalid_rental(self):
        rental = Rental(
            start_date=datetime.datetime(2017, 3, 15),
            return_date=datetime.datetime(2017, 3, 13)
        )
        with self.assertRaises(ValidationError):
            rental.clean()

    def test_str(self):
        rental = Rental(name='Fitnessflow')
        self.assertEqual(rental.__str__(), 'Rental by Fitnessflow')
{'fraction_non_alphanumeric': 0.0975609756097561, 'fraction_numerical': 0.03304484657749803, 'mean_word_length': 2.925925925925926, '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': '3776436', 'n_tokens_mistral': 405, 'n_tokens_neox': 368, 'n_words': 79}