mirror of
https://github.com/django/django.git
synced 2025-10-21 15:52:54 +00:00
Fixed #27818 -- Replaced try/except/pass with contextlib.suppress().
This commit is contained in:
parent
43a4835edf
commit
550cb3a365
67 changed files with 223 additions and 368 deletions
|
@ -1,5 +1,6 @@
|
|||
import datetime
|
||||
import json
|
||||
from contextlib import suppress
|
||||
|
||||
from django import forms
|
||||
from django.core import exceptions, serializers
|
||||
|
@ -10,14 +11,12 @@ from django.utils import timezone
|
|||
from . import PostgreSQLTestCase
|
||||
from .models import RangeLookupsModel, RangesModel
|
||||
|
||||
try:
|
||||
with suppress(ImportError):
|
||||
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