A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/django/django/commit/985434fb1d6bf2335bf96c6ebf91c3674f1f399f below:

[1.5.x] Fixed queries that may return unexpected results on MySQL due… · django/django@985434f · GitHub

6 6

from django import test

7 7

from django import forms

8 8

from django.core.exceptions import ValidationError

9 +

from django.db.models.fields import (

10 +

AutoField, BigIntegerField, BooleanField, CharField,

11 +

CommaSeparatedIntegerField, DateField, DateTimeField, DecimalField,

12 +

EmailField, FilePathField, FloatField, IntegerField, IPAddressField,

13 +

GenericIPAddressField, NullBooleanField, PositiveIntegerField,

14 +

PositiveSmallIntegerField, SlugField, SmallIntegerField, TextField,

15 +

TimeField, URLField)

9 16

from django.db import models

10 -

from django.db.models.fields.files import FieldFile

17 +

from django.db.models.fields.files import FileField, ImageField, FieldFile

11 18

from django.utils import six

12 19

from django.utils import unittest

13 20

@@ -414,3 +421,89 @@ def test_changed(self):

414 421

field = d._meta.get_field('myfile')

415 422

field.save_form_data(d, 'else.txt')

416 423

self.assertEqual(d.myfile, 'else.txt')

424 + 425 + 426 +

class PrepValueTest(test.TestCase):

427 +

def test_AutoField(self):

428 +

self.assertIsInstance(AutoField(primary_key=True).get_prep_value(1), int)

429 + 430 +

@unittest.skipIf(six.PY3, "Python 3 has no `long` type.")

431 +

def test_BigIntegerField(self):

432 +

self.assertIsInstance(BigIntegerField().get_prep_value(long(9999999999999999999)), long)

433 + 434 +

def test_BooleanField(self):

435 +

self.assertIsInstance(BooleanField().get_prep_value(True), bool)

436 + 437 +

def test_CharField(self):

438 +

self.assertIsInstance(CharField().get_prep_value(''), six.text_type)

439 +

self.assertIsInstance(CharField().get_prep_value(0), six.text_type)

440 + 441 +

def test_CommaSeparatedIntegerField(self):

442 +

self.assertIsInstance(CommaSeparatedIntegerField().get_prep_value('1,2'), six.text_type)

443 +

self.assertIsInstance(CommaSeparatedIntegerField().get_prep_value(0), six.text_type)

444 + 445 +

def test_DateField(self):

446 +

self.assertIsInstance(DateField().get_prep_value(datetime.date.today()), datetime.date)

447 + 448 +

def test_DateTimeField(self):

449 +

self.assertIsInstance(DateTimeField().get_prep_value(datetime.datetime.now()), datetime.datetime)

450 + 451 +

def test_DecimalField(self):

452 +

self.assertIsInstance(DecimalField().get_prep_value(Decimal('1.2')), Decimal)

453 + 454 +

def test_EmailField(self):

455 +

self.assertIsInstance(EmailField().get_prep_value('mailbox@domain.com'), six.text_type)

456 + 457 +

def test_FileField(self):

458 +

self.assertIsInstance(FileField().get_prep_value('filename.ext'), six.text_type)

459 +

self.assertIsInstance(FileField().get_prep_value(0), six.text_type)

460 + 461 +

def test_FilePathField(self):

462 +

self.assertIsInstance(FilePathField().get_prep_value('tests.py'), six.text_type)

463 +

self.assertIsInstance(FilePathField().get_prep_value(0), six.text_type)

464 + 465 +

def test_FloatField(self):

466 +

self.assertIsInstance(FloatField().get_prep_value(1.2), float)

467 + 468 +

def test_ImageField(self):

469 +

self.assertIsInstance(ImageField().get_prep_value('filename.ext'), six.text_type)

470 + 471 +

def test_IntegerField(self):

472 +

self.assertIsInstance(IntegerField().get_prep_value(1), int)

473 + 474 +

def test_IPAddressField(self):

475 +

self.assertIsInstance(IPAddressField().get_prep_value('127.0.0.1'), six.text_type)

476 +

self.assertIsInstance(IPAddressField().get_prep_value(0), six.text_type)

477 + 478 +

def test_GenericIPAddressField(self):

479 +

self.assertIsInstance(GenericIPAddressField().get_prep_value('127.0.0.1'), six.text_type)

480 +

self.assertIsInstance(GenericIPAddressField().get_prep_value(0), six.text_type)

481 + 482 +

def test_NullBooleanField(self):

483 +

self.assertIsInstance(NullBooleanField().get_prep_value(True), bool)

484 + 485 +

def test_PositiveIntegerField(self):

486 +

self.assertIsInstance(PositiveIntegerField().get_prep_value(1), int)

487 + 488 +

def test_PositiveSmallIntegerField(self):

489 +

self.assertIsInstance(PositiveSmallIntegerField().get_prep_value(1), int)

490 + 491 +

def test_SlugField(self):

492 +

self.assertIsInstance(SlugField().get_prep_value('slug'), six.text_type)

493 +

self.assertIsInstance(SlugField().get_prep_value(0), six.text_type)

494 + 495 +

def test_SmallIntegerField(self):

496 +

self.assertIsInstance(SmallIntegerField().get_prep_value(1), int)

497 + 498 +

def test_TextField(self):

499 +

self.assertIsInstance(TextField().get_prep_value('Abc'), six.text_type)

500 +

self.assertIsInstance(TextField().get_prep_value(0), six.text_type)

501 + 502 +

def test_TimeField(self):

503 +

self.assertIsInstance(

504 +

TimeField().get_prep_value(datetime.datetime.now().time()),

505 +

datetime.time)

506 + 507 +

def test_URLField(self):

508 +

self.assertIsInstance(URLField().get_prep_value('http://domain.com'), six.text_type)

509 +

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4