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

Inappropriateness in unittest documentation with actual behavior #118912

Closed
Labels
docsDocumentation in the Doc dir
@AliyevH

Description

@AliyevH

Documentation

https://docs.python.org/3/library/unittest.mock.html#auto-speccing

Your tests can pass silently and incorrectly because of the typo.

mock=Mock(name='Thing',return_value=None)mock(1,2,3)mock.assret_called_once_with(4,5,6)# Intentional typo!

Your tests can pass silently and incorrectly because of the typo.


Expected that tests will pass as written in doc.

But actually script fails with raising error.

raise AttributeError(AttributeError:'assret_called_once_with' is not a valid assertion. Use a spec for the mock if 'assret_called_once_with' is meant to be an attribute.. Did you mean: 'assert_called_once_with'?

Am i missing something? I have tested this in Python3.11 and Python 3.12.
Looks like documentation must be updated or script must work as said in documenation.

Thanks for attention

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsDocumentation in the Doc dir

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp