| Conditions | 1 |
| Total Lines | 57 |
| Code Lines | 52 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | import json |
||
| 70 | def expected_entrants_finished_race1(): |
||
| 71 | expected_user1 = User( |
||
| 72 | id="kzM65aWX7do1y8q0", |
||
| 73 | full_name="SEJay#5897", |
||
| 74 | name="SEJay", |
||
| 75 | discriminator="5897", |
||
| 76 | url="/user/kzM65aWX7do1y8q0", |
||
| 77 | avatar=( |
||
| 78 | "https://racetime.gg/media/lukeacevedo_beer_videogames-01_1x.png" |
||
| 79 | ), |
||
| 80 | pronouns="he/him", |
||
| 81 | flair="", |
||
| 82 | twitch_name="sejay_28", |
||
| 83 | twitch_display_name="SEJay_28", |
||
| 84 | twitch_channel="https://www.twitch.tv/sejay_28", |
||
| 85 | can_moderate=False, |
||
| 86 | ) |
||
| 87 | expected_status_finished = Status( |
||
| 88 | value="done", |
||
| 89 | verbose_value="Finished", |
||
| 90 | help_text="This race has been completed" |
||
| 91 | ) |
||
| 92 | expected_entrants = [ |
||
| 93 | Entrant( |
||
| 94 | user=expected_user1, |
||
| 95 | status=expected_status_finished, |
||
| 96 | finish_time=timedelta(hours=2, minutes=34, seconds=23.909043), |
||
| 97 | finished_at=datetime(2020, 12, 14, 6, 8, 45, |
||
| 98 | 820000, tzinfo=timezone.utc), |
||
| 99 | place=1, |
||
| 100 | place_ordinal="1st", |
||
| 101 | score=None, |
||
| 102 | score_change=None, |
||
| 103 | comment="191", |
||
| 104 | has_comment=True, |
||
| 105 | stream_live=False, |
||
| 106 | stream_override=False, |
||
| 107 | actions=[] |
||
| 108 | ), |
||
| 109 | Entrant( |
||
| 110 | user=expected_user1, |
||
| 111 | status=expected_status_finished, |
||
| 112 | finish_time=timedelta(hours=2, minutes=43, seconds=51.353469), |
||
| 113 | finished_at=datetime(2020, 12, 14, 6, 18, 13, |
||
| 114 | 265000, tzinfo=timezone.utc), |
||
| 115 | place=2, |
||
| 116 | place_ordinal="2nd", |
||
| 117 | score=None, |
||
| 118 | score_change=None, |
||
| 119 | comment="190 woof", |
||
| 120 | has_comment=True, |
||
| 121 | stream_live=False, |
||
| 122 | stream_override=False, |
||
| 123 | actions=[] |
||
| 124 | ), None, None, None, None, None, None, None, None |
||
| 125 | ] |
||
| 126 | return expected_entrants |
||
| 127 | |||
| 160 |