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

Improvetest_inspect #103553

Closed
Closed
Assignees
sobolevn
Labels
testsTests in the Lib/test dirtype-bugAn unexpected behavior, bug, or error
@sobolevn

Description

@sobolevn

While working on#103406 I've noticed that there are some problems withtest_inspect that we can easily fix.

List of problems I found:

  1. f3=self.makeCallable('**c')
    self.assertEqualException(f3,'1, 2')
    self.assertEqualException(f3,'1, 2, a=1, b=2')
    f4=self.makeCallable('*, a, b=0')
    self.assertEqualException(f3,'1, 2')
    self.assertEqualException(f3,'1, 2, a=1, b=2')
    Heref4 is not ever used, butf3 has duplicate asserts. It looks like a copy-paste error to me. I propose to add asserts forf4 as well
  2. # XXX: Python inconsistency
    # - for functions and bound methods: unexpected keyword 'c'
    # - for unbound methods: multiple values for keyword 'a'
    #self.assertEqualException(f, '1, c=3, a=2')
    Unbound methods do not exist anymore, so this comment is outdated. Probably, it should be removed and assert should be restored
  3. # XXX: success of this one depends on dict order
    ## self.assertEqualException(f, '2, 3, 4, a=1, c=5')
    It says that the result depends on the dict order. But, dicts are ordered now. Let's see if that possible to uncomment / modernize this test somehow
  4. psig=inspect.signature(partial(partial(test,1),2))
    This variable is not needed, because it is not used and there's an identical test right above it:
    self.assertEqual(self.signature(partial(partial(test,1),2)),
    ((('c', ...,int,"positional_or_keyword"),),
    42))
  5. There are also several unsused variables that can be removed durin this cleanup

Here's my PR :)

Linked PRs

Metadata

Metadata

Assignees

Labels

testsTests in the Lib/test dirtype-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