Skip to content

Commit

Permalink
fixing format specifiers
Browse files Browse the repository at this point in the history
  • Loading branch information
shanbady committed Jan 17, 2025
1 parent 1a11003 commit 6fa4e4e
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion channels/serializers_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ def test_create_channel(base_channel_data, channel_detail, channel_type):
"""
paths = sorted(
(p.learning_resource for p in LearningPathFactory.create_batch(2)),
key=lambda list: list.id,
key=lambda lst: lst.id,
reverse=True,
)

Expand Down
18 changes: 9 additions & 9 deletions learning_resources/factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def _post_gen_tags(obj, create, extracted, **kwargs): # noqa: ARG001
class LearningResourceContentTagFactory(DjangoModelFactory):
"""Factory for LearningResourceContentTag objects"""

name = factory.Sequence(lambda n: "Tag %03d" % n)
name = factory.Sequence(lambda n: f"Tag {n:03d}")

class Meta:
model = models.LearningResourceContentTag
Expand All @@ -86,7 +86,7 @@ class Meta:
class LearningResourceTopicFactory(DjangoModelFactory):
"""Factory for learning resource topics"""

name = factory.Sequence(lambda n: "Topic %03d" % n)
name = factory.Sequence(lambda n: f"Topic {n:03d}")

class Meta:
model = models.LearningResourceTopic
Expand Down Expand Up @@ -137,7 +137,7 @@ class Meta:
class LearningResourceSchoolFactory(DjangoModelFactory):
"""Factory for LearningResourceDepartment"""

name = factory.Sequence(lambda n: "%03d name" % n)
name = factory.Sequence(lambda n: f"{n:03d} name")
url = factory.Faker("url")

class Meta:
Expand All @@ -147,8 +147,8 @@ class Meta:
class LearningResourceDepartmentFactory(DjangoModelFactory):
"""Factory for LearningResourceDepartment"""

department_id = factory.Sequence(lambda n: "%03d" % n)
name = factory.Sequence(lambda n: "%03d name" % n)
department_id = factory.Sequence(lambda n: f"{n:03d}")
name = factory.Sequence(lambda n: f"{n:03d} name")
school = factory.SubFactory(
"learning_resources.factories.LearningResourceSchoolFactory"
)
Expand Down Expand Up @@ -198,7 +198,7 @@ class LearningResourceFactory(DjangoModelFactory):
choices=constants.LearningResourceType.names()
)
readable_id = factory.Sequence(
lambda n: "RESOURCEN%03d_%03d.MIT" % (n, random.randint(1, 1000)) # noqa: S311
lambda n: f"RESOURCEN{n:03d}_{random.randint(1, 1000)}.MIT" # noqa: S311
)
etl_source = "mock"
title = factory.Faker("word")
Expand Down Expand Up @@ -493,7 +493,7 @@ class LearningResourceRunFactory(DjangoModelFactory):
]
),
)
run_id = factory.Sequence(lambda n: "RUN%03d.MIT_run" % n)
run_id = factory.Sequence(lambda n: f"RUN{n:03d}.MIT_run")
title = factory.Faker("word")
description = factory.Faker("sentence")
full_description = factory.Faker("text")
Expand Down Expand Up @@ -839,7 +839,7 @@ class VideoFactory(DjangoModelFactory):
is_video=True,
create_video=False,
)
duration = factory.Sequence(lambda n: "PT%02dM%02dS" % (n, n))
duration = factory.Sequence(lambda n: f"PT{n:02d}M{n:02d}S")

class Meta:
model = models.Video
Expand All @@ -852,7 +852,7 @@ class Params:
class VideoChannelFactory(DjangoModelFactory):
"""Factory for VideoChannels"""

channel_id = factory.Sequence(lambda n: "VIDEO-CHANNEL-%03d.MIT" % n)
channel_id = factory.Sequence(lambda n: f"VIDEO-CHANNEL-{n:03d}.MIT")
title = factory.Faker("word")

class Params:
Expand Down
2 changes: 1 addition & 1 deletion learning_resources/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def filter_free(self, queryset, _, value):
free_filter = (
Q(runs__isnull=True)
| Q(runs__resource_prices__isnull=True)
| Q(runs__resource_prices__amount=Decimal(0.00))
| Q(runs__resource_prices__amount=Decimal("0.00"))
) & Q(professional=False)
if value:
# Free resources
Expand Down
2 changes: 1 addition & 1 deletion news_events/factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class FeedItemFactory(factory.django.DjangoModelFactory):
"""Factory for feed items"""

source = factory.SubFactory(FeedSourceFactory)
guid = factory.Sequence(lambda n: "http://feed.mit.edu/%03d/rss" % n)
guid = factory.Sequence(lambda n: f"http://feed.mit.edu/{n:03d}/rss")
title = factory.Faker("word")
url = factory.Faker("url")
summary = factory.Faker("paragraph")
Expand Down

0 comments on commit 6fa4e4e

Please sign in to comment.