MCPcopy Create free account
hub / github.com/rthalley/dnspython / MockSock

Class MockSock

tests/test_async.py:753–770  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

751
752
753class MockSock:
754 def __init__(self, wire1, from1, wire2, from2):
755 self.family = socket.AF_INET
756 self.first_time = True
757 self.wire1 = wire1
758 self.from1 = from1
759 self.wire2 = wire2
760 self.from2 = from2
761
762 async def sendto(self, data, where, timeout):
763 return len(data)
764
765 async def recvfrom(self, bufsize, expiration):
766 if self.first_time:
767 self.first_time = False
768 return self.wire1, self.from1
769 else:
770 return self.wire2, self.from2
771
772
773class IgnoreErrors(unittest.TestCase):

Callers 2

mock_receiveMethod · 0.70
abadMethod · 0.70

Calls

no outgoing calls

Tested by 2

mock_receiveMethod · 0.56
abadMethod · 0.56

Used in the wild real call sites across dependent graphs

searching dependent graphs…