mirror of
https://github.com/django/django.git
synced 2025-07-24 13:44:32 +00:00
Reverted "Fixed #27818 -- Replaced try/except/pass with contextlib.suppress()."
This reverts commit 550cb3a365
because try/except performs better.
This commit is contained in:
parent
8b2515a450
commit
6e4c6281db
66 changed files with 351 additions and 207 deletions
|
@ -1,6 +1,5 @@
|
|||
import datetime
|
||||
import json
|
||||
from contextlib import suppress
|
||||
|
||||
from django import forms
|
||||
from django.core import exceptions, serializers
|
||||
|
@ -11,12 +10,14 @@ from django.utils import timezone
|
|||
from . import PostgreSQLTestCase
|
||||
from .models import RangeLookupsModel, RangesModel
|
||||
|
||||
with suppress(ImportError):
|
||||
try:
|
||||
from psycopg2.extras import DateRange, DateTimeTZRange, NumericRange
|
||||
from django.contrib.postgres import fields as pg_fields, forms as pg_forms
|
||||
from django.contrib.postgres.validators import (
|
||||
RangeMaxValueValidator, RangeMinValueValidator,
|
||||
)
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
|
||||
class TestSaveLoad(PostgreSQLTestCase):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue