Skip to content
Merged
Changes from all commits
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
STY: rename @classmethod arg to cls
  • Loading branch information
jorenham authored and charris committed Oct 14, 2025
commit 7fd2ad9eff9cb04bcea5e2b6f89e8870329c5c93
32 changes: 16 additions & 16 deletions numpy/_core/tests/test_stringdtype.py
Original file line number Diff line number Diff line change
Expand Up @@ -1631,17 +1631,17 @@ class TestImplementation:
"""

@classmethod
def setup_class(self):
self.MISSING = 0x80
self.INITIALIZED = 0x40
self.OUTSIDE_ARENA = 0x20
self.LONG = 0x10
self.dtype = StringDType(na_object=np.nan)
self.sizeofstr = self.dtype.itemsize
sp = self.dtype.itemsize // 2 # pointer size = sizeof(size_t)
def setup_class(cls):
cls.MISSING = 0x80
cls.INITIALIZED = 0x40
cls.OUTSIDE_ARENA = 0x20
cls.LONG = 0x10
cls.dtype = StringDType(na_object=np.nan)
cls.sizeofstr = cls.dtype.itemsize
sp = cls.dtype.itemsize // 2 # pointer size = sizeof(size_t)
# Below, size is not strictly correct, since it really uses
# 7 (or 3) bytes, but good enough for the tests here.
self.view_dtype = np.dtype([
cls.view_dtype = np.dtype([
('offset', f'u{sp}'),
('size', f'u{sp // 2}'),
('xsiz', f'V{sp // 2 - 1}'),
Expand All @@ -1652,13 +1652,13 @@ def setup_class(self):
('size', f'u{sp // 2}'),
('offset', f'u{sp}'),
])
self.s_empty = ""
self.s_short = "01234"
self.s_medium = "abcdefghijklmnopqrstuvwxyz"
self.s_long = "-=+" * 100
self.a = np.array(
[self.s_empty, self.s_short, self.s_medium, self.s_long],
self.dtype)
cls.s_empty = ""
cls.s_short = "01234"
cls.s_medium = "abcdefghijklmnopqrstuvwxyz"
cls.s_long = "-=+" * 100
cls.a = np.array(
[cls.s_empty, cls.s_short, cls.s_medium, cls.s_long],
cls.dtype)

def get_view(self, a):
# Cannot view a StringDType as anything else directly, since
Expand Down
Loading