From 4ea4c3eddd7a88212ada49351cd869162d3e3736 Mon Sep 17 00:00:00 2001 From: Aleksander Vognild Burkow Date: Tue, 5 Feb 2019 14:23:06 +0100 Subject: [PATCH] Ignore external psycopg2 types --- django-stubs/contrib/postgres/fields/ranges.pyi | 2 +- test-data/typecheck/fields.test | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/django-stubs/contrib/postgres/fields/ranges.pyi b/django-stubs/contrib/postgres/fields/ranges.pyi index b4af716..2a26f7c 100644 --- a/django-stubs/contrib/postgres/fields/ranges.pyi +++ b/django-stubs/contrib/postgres/fields/ranges.pyi @@ -2,7 +2,7 @@ from typing import Any from django.db import models -from psycopg2.extras import DateRange, DateTimeTZRange, NumericRange +from psycopg2.extras import DateRange, DateTimeTZRange, NumericRange # type: ignore class RangeField(models.Field): empty_strings_allowed: bool = ... diff --git a/test-data/typecheck/fields.test b/test-data/typecheck/fields.test index 46977d7..60f482e 100644 --- a/test-data/typecheck/fields.test +++ b/test-data/typecheck/fields.test @@ -40,7 +40,6 @@ reveal_type(user.text) # E: Revealed type is 'builtins.str' [CASE test_model_field_classes_from_exciting_locations] from django.db import models from django.contrib.postgres import fields as pg_fields -from psycopg2.extras import DateTimeTZRange from decimal import Decimal class Booking(models.Model): @@ -50,7 +49,7 @@ class Booking(models.Model): booking = Booking() reveal_type(booking.id) # E: Revealed type is 'builtins.int' -reveal_type(booking.time_range) # E: Revealed type is 'DateTimeTZRange' +reveal_type(booking.time_range) # E: Revealed type is 'Any' reveal_type(booking.some_decimal) # E: Revealed type is 'Decimal' [CASE test_add_id_field_if_no_primary_key_defined]