Skip to content

Commit

Permalink
style: 删除掉多余的注释和修改变量名
Browse files Browse the repository at this point in the history
  • Loading branch information
BigOrangeQWQ committed Nov 23, 2024
1 parent e243c99 commit 525d0d3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
10 changes: 5 additions & 5 deletions tests/github/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,17 @@
}


def get_mock_event(event_type: type[T], path_name: str = "", id: str = "1") -> T:
def get_mock_event(event_type: type[T], filename: str = "", id: str = "1") -> T:
"""通过事件类型获取事件对象"""

if event_type not in EVENT_INFO:
raise ValueError(f"Unknown event type: {event_type}")

event_name, event_path_name = EVENT_INFO[event_type]
if path_name:
event_path_name = path_name
event_name, _filename = EVENT_INFO[event_type]
if filename:
_filename = filename

event_path = Path(__file__).parent / "events" / f"{event_path_name}.json"
event_path = Path(__file__).parent / "events" / f"{_filename}.json"
event = Adapter.payload_to_event(id, event_name, event_path.read_bytes())

assert isinstance(event, event_type)
Expand Down
6 changes: 0 additions & 6 deletions tests/github/publish/process/test_publish_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -1244,9 +1244,6 @@ async def test_convert_pull_request_to_draft(

async with app.test_matcher() as ctx:
adapter, bot = get_github_bot(ctx)
# event_path = Path(__file__).parent.parent.parent / "events" / "issue-open.json"
# event = Adapter.payload_to_event("1", "issues", event_path.read_bytes())
# assert isinstance(event, IssuesOpened)
event = get_mock_event(IssuesOpened)

ctx.should_call_api(
Expand Down Expand Up @@ -1388,9 +1385,6 @@ async def test_process_publish_check_ready_for_review(

async with app.test_matcher() as ctx:
adapter, bot = get_github_bot(ctx)
# event_path = Path(__file__).parent.parent.parent / "events" / "issue-open.json"
# event = Adapter.payload_to_event("1", "issues", event_path.read_bytes())
# assert isinstance(event, IssuesOpened)
event = get_mock_event(IssuesOpened)

ctx.should_call_api(
Expand Down

0 comments on commit 525d0d3

Please sign in to comment.