Hybrid machine learning based on Hamiltonian formulations has recently been successfully demonstrated for simple mechanical systems. In this work, we stress-test the method on both simple mass-spring systems and more complex and realistic systems with several internal and external ports, including a system with multiple connected tanks. We quantify performance under various conditions and show that imposing different assumptions greatly affects the performance, highlighting advantages and limitations of the method. We demonstrate that port-Hamiltonian neural networks can be extended to higher dimensions with state-dependent ports. We consider learning on systems with known and unknown external ports. The port-Hamiltonian formulation allows for detecting deviations and still provide a valid model when the deviations are removed. Finally, we propose a symmetric high-order integration scheme for improved training on sparse and noisy data.