

@mock.patch('socket.create_connection')
def test_copy(self, socket):
    'KafkaConnection copies work as expected'
    conn = KafkaConnection('kafka', 9092)
    self.assertEqual(socket.call_count, 1)
    copy = conn.copy()
    self.assertEqual(socket.call_count, 1)
    self.assertEqual(copy.host, 'kafka')
    self.assertEqual(copy.port, 9092)
    self.assertEqual(copy._sock, None)
    copy.reinit()
    self.assertEqual(socket.call_count, 2)
    self.assertNotEqual(copy._sock, None)

dataset/ETHPy150Open dpkp/kafka-python/test/test_conn_legacy.py TestKafkaConnection.test_copy/original