| Conditions | 1 |
| Total Lines | 61 |
| Code Lines | 55 |
| 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 | # Copyright Pincer 2021-Present |
||
| 71 | @staticmethod |
||
| 72 | def test_get(): |
||
| 73 | |||
| 74 | guild = Guild.from_dict(FAKE_GUILD) |
||
| 75 | |||
| 76 | assert guild == Guild( |
||
| 77 | id=0, |
||
| 78 | name="test-server", |
||
| 79 | features=[], |
||
| 80 | emojis=[ |
||
| 81 | Emoji( |
||
| 82 | name="test-emoji", |
||
| 83 | roles=[], |
||
| 84 | id=0, |
||
| 85 | require_colons=True, |
||
| 86 | managed=False, |
||
| 87 | animated=False, |
||
| 88 | available=True |
||
| 89 | ) |
||
| 90 | ], |
||
| 91 | stickers=[], |
||
| 92 | owner_id=0, |
||
| 93 | region="us-east", |
||
| 94 | afk_timeout=300, |
||
| 95 | system_channel_id=0, |
||
| 96 | widget_enabled=False, |
||
| 97 | widget_channel_id=0, |
||
| 98 | verification_level=0, |
||
| 99 | roles=[ |
||
| 100 | Role( |
||
| 101 | id=0, |
||
| 102 | name="@everyone", |
||
| 103 | permissions=0, |
||
| 104 | position=0, |
||
| 105 | color=0, |
||
| 106 | hoist=False, |
||
| 107 | managed=False, |
||
| 108 | mentionable=False, |
||
| 109 | ) |
||
| 110 | ], |
||
| 111 | default_message_notifications=0, |
||
| 112 | mfa_level=0, |
||
| 113 | explicit_content_filter=0, |
||
| 114 | max_members=250000, |
||
| 115 | max_video_channel_users=25, |
||
| 116 | premium_tier=0, |
||
| 117 | premium_subscription_count=0, |
||
| 118 | system_channel_flags=0, |
||
| 119 | preferred_locale="en-US", |
||
| 120 | premium_progress_bar_enabled=False, |
||
| 121 | nsfw=False, |
||
| 122 | nsfw_level=0, |
||
| 123 | channels=[ |
||
| 124 | Channel( |
||
| 125 | id=0, |
||
| 126 | type=4, |
||
| 127 | name="Text Channels", |
||
| 128 | position=0, |
||
| 129 | guild_id=0, |
||
| 130 | permission_overwrites=[], |
||
| 131 | nsfw=False |
||
| 132 | ) |
||
| 135 |