MCPcopy Index your code
hub / github.com/python/cpython / __init__

Method __init__

Lib/test/test_struct.py:189–209  ·  view source on GitHub ↗
(self, format)

Source from the content-addressed store, hash-verified

187
188 class IntTester(unittest.TestCase):
189 def __init__(self, format):
190 super(IntTester, self).__init__(methodName='test_one')
191 self.format = format
192 self.code = format[-1]
193 self.byteorder = format[:-1]
194 if not self.byteorder in byteorders:
195 raise ValueError("unrecognized packing byteorder: %s" %
196 self.byteorder)
197 self.bytesize = struct.calcsize(format)
198 self.bitsize = self.bytesize * 8
199 if self.code in tuple('bhilqn'):
200 self.signed = True
201 self.min_value = -(2**(self.bitsize-1))
202 self.max_value = 2**(self.bitsize-1) - 1
203 elif self.code in tuple('BHILQN'):
204 self.signed = False
205 self.min_value = 0
206 self.max_value = 2**self.bitsize - 1
207 else:
208 raise ValueError("unrecognized format code: %s" %
209 self.code)
210
211 def test_one(self, x, pack=struct.pack,
212 unpack=struct.unpack,

Callers

nothing calls this directly

Calls 2

superClass · 0.85
__init__Method · 0.45

Tested by

no test coverage detected