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

MisleadingDeprecationWarning inunittest: It is deprecated to return a value!=None #97837

Closed
Labels
type-bugAn unexpected behavior, bug, or error
@sobolevn

Description

@sobolevn

In python!= andis not are two different things.
Right now the deprecation warning says!=, let's see if that's true:

fromunittestimportTestCase,mainclassNothing:def__eq__(self,o):returnoisNoneclassTestExample(TestCase):deftest_method(self):n=Nothing()self.assertEqual(n,None)returnnmain()

It still raises this:

/Users/sobolev/Desktop/cpython/Lib/unittest/case.py:678: DeprecationWarning: It is deprecated to return a value!=None from a test case (<bound method TestExample.test_method of <__main__.TestExample testMethod=test_method>>)  return self.run(*args, **kwds).----------------------------------------------------------------------Ran 1 test in 0.003sOK

I believe that this is misleading. The proper message should say:It is deprecated to return a value that is not None from a test case

I will send a PR with the fix.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp