Skip to content

Commit

Permalink
Merge branch 'main' into proceedings-cache
Browse files Browse the repository at this point in the history
  • Loading branch information
jennifer-richards authored Feb 5, 2025
2 parents fa4625f + 1fbedd7 commit 5387c9b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
13 changes: 8 additions & 5 deletions ietf/doc/factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import factory.fuzzy
import datetime

from typing import Optional # pyflakes:ignore
from typing import Any # pyflakes:ignore

from django.conf import settings
from django.utils import timezone
Expand Down Expand Up @@ -37,13 +37,16 @@ class Meta:
model = Document
skip_postgeneration_save = True

# n.b., a few attributes are typed as Any so mypy won't complain when we override in subclasses
title = factory.Faker('sentence',nb_words=5)
abstract = factory.Faker('paragraph', nb_sentences=5)
abstract: Any = factory.Faker('paragraph', nb_sentences=5)
rev = '00'
std_level_id = None # type: Optional[str]
std_level_id: Any = None
intended_std_level_id = None
time = timezone.now()
expires = factory.LazyAttribute(lambda o: o.time+datetime.timedelta(days=settings.INTERNET_DRAFT_DAYS_TO_EXPIRE))
expires: Any = factory.LazyAttribute(
lambda o: o.time+datetime.timedelta(days=settings.INTERNET_DRAFT_DAYS_TO_EXPIRE)
)
pages = factory.fuzzy.FuzzyInteger(2,400)


Expand Down Expand Up @@ -282,7 +285,7 @@ class Meta:

type = 'added_comment'
by = factory.SubFactory('ietf.person.factories.PersonFactory')
doc = factory.SubFactory(DocumentFactory)
doc: Any = factory.SubFactory(DocumentFactory) # `Any` to appease mypy when a subclass overrides doc
desc = factory.Faker('sentence',nb_words=6)

@factory.lazy_attribute
Expand Down
2 changes: 1 addition & 1 deletion ietf/ipr/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -726,7 +726,7 @@ def test_notify_generic(self):
self.assertIn(f'{settings.IDTRACKER_BASE_URL}{urlreverse("ietf.ipr.views.showlist")}', get_payload_text(outbox[1]).replace('\n',' '))

def send_ipr_email_helper(self) -> tuple[str, IprEvent, HolderIprDisclosure]:
ipr = HolderIprDisclosureFactory()
ipr = HolderIprDisclosureFactory.create() # call create() explicitly so mypy sees correct type
url = urlreverse('ietf.ipr.views.email',kwargs={ "id": ipr.id })
self.client.login(username="secretary", password="secretary+password")
yesterday = date_today() - datetime.timedelta(1)
Expand Down
3 changes: 2 additions & 1 deletion ietf/meeting/tests_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -2125,7 +2125,8 @@ def create_timeslots_url(meeting):
@staticmethod
def create_bare_meeting(number=120) -> Meeting:
"""Create a basic IETF meeting"""
return MeetingFactory(
# Call create() explicitly so mypy sees the correct type
return MeetingFactory.create(
type_id='ietf',
number=number,
date=date_today() + datetime.timedelta(days=10),
Expand Down

0 comments on commit 5387c9b

Please sign in to comment.