Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add a test case
  • Loading branch information
hauntsaninja committed Oct 11, 2022
commit 2d5f29026e2a0376edc5ac9563966dbbf5e27c64
4 changes: 3 additions & 1 deletion Lib/test/test_dataclasses.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,8 +254,10 @@ def test_field_named_object_frozen(self):
@dataclass(frozen=True)
class C:
object: str
c = C('foo')
BUILTINS: int # gh-96151
c = C('foo', 5)
self.assertEqual(c.object, 'foo')
self.assertEqual(c.BUILTINS, 5)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please create a separate function for this, and don't mix it in with existing tests. Maybe test_field_named_BUILTINS or similar.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the review, made the change :-)


def test_field_named_like_builtin(self):
# Attribute names can shadow built-in names
Expand Down