Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit7f4a191

Browse files
committed
Fix brittle way of checking warning messages
Which was causing a type error.
1 parentaee7078 commit7f4a191

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

‎test/deprecation/test_attributes.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def test_util_alias_access_warns() -> None:
5151
git.util
5252

5353
assertlen(ctx)==1
54-
message=ctx[0].message.args[0]
54+
message=str(ctx[0].message)
5555
assert"git.util"inmessage
5656
assert"git.index.util"inmessage
5757
assert"should not be relied on"inmessage
@@ -61,7 +61,7 @@ def test_util_alias_import_warns() -> None:
6161
withpytest.deprecated_call()asctx:
6262
fromgitimportutil# noqa: F401
6363

64-
message=ctx[0].message.args[0]
64+
message=str(ctx[0].message)
6565
assert"git.util"inmessage
6666
assert"git.index.util"inmessage
6767
assert"should not be relied on"inmessage
@@ -114,10 +114,12 @@ def test_private_module_alias_access_warns(self, name: str, fullname: str) -> No
114114
getattr(git,name)
115115

116116
assertlen(ctx)==1
117-
assertctx[0].message.args[0].endswith(f"Use{fullname} instead.")
117+
message=str(ctx[0].message)
118+
assertmessage.endswith(f"Use{fullname} instead.")
118119

119120
deftest_private_module_alias_import_warns(self,name:str,fullname:str)->None:
120121
withpytest.deprecated_call()asctx:
121122
exec(f"from git import{name}")
122123

123-
assertctx[0].message.args[0].endswith(f"Use{fullname} instead.")
124+
message=str(ctx[0].message)
125+
assertmessage.endswith(f"Use{fullname} instead.")

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp