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