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

Method testFilter

Lib/test/test_socket.py:2327–2334  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2325 @unittest.skipUnless(hasattr(socket, "CAN_RAW_FILTER"),
2326 'socket.CAN_RAW_FILTER required for this test.')
2327 def testFilter(self):
2328 can_id, can_mask = 0x200, 0x700
2329 can_filter = struct.pack("=II", can_id, can_mask)
2330 with socket.socket(socket.PF_CAN, socket.SOCK_RAW, socket.CAN_RAW) as s:
2331 s.setsockopt(socket.SOL_CAN_RAW, socket.CAN_RAW_FILTER, can_filter)
2332 self.assertEqual(can_filter,
2333 s.getsockopt(socket.SOL_CAN_RAW, socket.CAN_RAW_FILTER, 8))
2334 s.setsockopt(socket.SOL_CAN_RAW, socket.CAN_RAW_FILTER, bytearray(can_filter))
2335
2336
2337@unittest.skipUnless(HAVE_SOCKET_CAN, 'SocketCan required for this test.')

Callers

nothing calls this directly

Calls 5

socketMethod · 0.80
packMethod · 0.45
setsockoptMethod · 0.45
assertEqualMethod · 0.45
getsockoptMethod · 0.45

Tested by

no test coverage detected