test: Suppress notices from mypy involving factory types

This commit is contained in:
Jennifer Richards 2023-05-15 12:20:02 -03:00
parent cbb946455f
commit 22bf508922
No known key found for this signature in database
GPG key ID: 9B2BF5C5ADDA6A6E
4 changed files with 13 additions and 13 deletions

View file

@ -1493,7 +1493,7 @@ class EditTimeslotsTests(IetfSeleniumTestCase):
"""Test the timeslot editor"""
def setUp(self):
super().setUp()
self.meeting: Meeting = MeetingFactory(
self.meeting: Meeting = MeetingFactory( # type: ignore[annotation-unchecked]
type_id='ietf',
number=120,
date=date_today() + datetime.timedelta(days=10),
@ -1570,13 +1570,13 @@ class EditTimeslotsTests(IetfSeleniumTestCase):
delete_time = delete_time_local.astimezone(datetime.timezone.utc)
duration = datetime.timedelta(minutes=60)
delete: [TimeSlot] = TimeSlotFactory.create_batch(
delete: [TimeSlot] = TimeSlotFactory.create_batch( # type: ignore[annotation-unchecked]
2,
meeting=self.meeting,
time=delete_time_local,
duration=duration,
)
keep: [TimeSlot] = [
keep: [TimeSlot] = [ # type: ignore[annotation-unchecked]
TimeSlotFactory(
meeting=self.meeting,
time=keep_time,
@ -1613,14 +1613,14 @@ class EditTimeslotsTests(IetfSeleniumTestCase):
hours = [10, 12]
other_days = [self.meeting.get_meeting_date(d) for d in range(1, 3)]
delete: [TimeSlot] = [
delete: [TimeSlot] = [ # type: ignore[annotation-unchecked]
TimeSlotFactory(
meeting=self.meeting,
time=datetime_from_date(delete_day, self.meeting.tz()).replace(hour=hour),
) for hour in hours
]
keep: [TimeSlot] = [
keep: [TimeSlot] = [ # type: ignore[annotation-unchecked]
TimeSlotFactory(
meeting=self.meeting,
time=datetime_from_date(day, self.meeting.tz()).replace(hour=hour),

View file

@ -2357,7 +2357,7 @@ class EditTimeslotsTests(TestCase):
def test_invalid_edit_timeslot(self):
meeting = self.create_bare_meeting()
ts: TimeSlot = TimeSlotFactory(meeting=meeting, name='slot') # n.b., colon indicates type hinting
ts: TimeSlot = TimeSlotFactory(meeting=meeting, name='slot') # type: ignore[annotation-unchecked]
self.login()
r = self.client.post(
self.edit_timeslot_url(ts),

View file

@ -67,7 +67,7 @@ class Command(BaseCommand):
pprint(connection.queries)
raise
objects = [] # type: List[object]
objects: List[object] = [] # type: ignore[annotation-unchecked]
model_objects = {}
import ietf.name.models

View file

@ -1204,15 +1204,15 @@ class SubmitTests(BaseSubmitTestCase):
Unlike some other tests in this module, does not confirm draft if this would be required.
"""
orig_draft = DocumentFactory(
orig_draft: Document = DocumentFactory( # type: ignore[annotation-unchecked]
type_id='draft',
group=GroupFactory(type_id=group_type) if group_type else None,
stream_id=stream_type,
) # type: Document
)
name = orig_draft.name
group = orig_draft.group
new_rev = '%02d' % (int(orig_draft.rev) + 1)
author = PersonFactory() # type: Person
author: Person = PersonFactory() # type: ignore[annotation-unchecked]
DocumentAuthor.objects.create(person=author, document=orig_draft)
orig_draft.docextresource_set.create(name_id='faq', value='https://faq.example.com/')
orig_draft.docextresource_set.create(name_id='wiki', value='https://wiki.example.com', display_name='Test Wiki')
@ -1982,7 +1982,7 @@ class SubmitTests(BaseSubmitTestCase):
group = GroupFactory()
# someone to be notified of resource suggestion when permission not granted
RoleFactory(group=group, person=PersonFactory(), name_id='chair')
submission = SubmissionFactory(state_id='grp-appr', group=group) # type: Submission
submission: Submission = SubmissionFactory(state_id='grp-appr', group=group) # type: ignore[annotation-unchecked]
SubmissionExtResourceFactory(submission=submission)
# use secretary user to ensure we have permission to approve
@ -2000,7 +2000,7 @@ class SubmitTests(BaseSubmitTestCase):
group = GroupFactory()
# someone to be notified of resource suggestion when permission not granted
RoleFactory(group=group, person=PersonFactory(), name_id='chair')
submission = SubmissionFactory(state_id=state, group=group) # type: Submission
submission: Submission = SubmissionFactory(state_id=state, group=group) # type: ignore[annotation-unchecked]
SubmissionExtResourceFactory(submission=submission)
url = urlreverse(
@ -2052,7 +2052,7 @@ class SubmitTests(BaseSubmitTestCase):
def test_forcepost_with_extresources(self):
# state needs to be one that has 'posted' as a next state
submission = SubmissionFactory(state_id='grp-appr') # type: Submission
submission: Submission = SubmissionFactory(state_id='grp-appr') # type: ignore[annotation-unchecked]
SubmissionExtResourceFactory(submission=submission)
url = urlreverse(