An excerpt from my textbook:
It is assumed that there is no macroscopic motion of the system. Therefore, $\Delta E_{mech} = 0$ and the first law of thermodynamics can be written as $$\Delta E_{sys} = \Delta E_{mech} + \Delta E_{th} = \Delta E_{th} = W + Q$$
But $\Delta E_{mech} = \Delta K + \Delta U$, the mechanical kinetic and potential energy. And so if, for example, a piston compresses an ideal gas and it is not an isobaric process, would the increase in pressure not increase the system's mechanical potential energy, since pressure is a restoring force?
More specifically I found this question in my textbook:
A gas cylinder and piston are covered with heavy insulation. The piston is pushed into the cylinder, compressing the gas. In this process the gas temperature: a) Increases. b) Decreases. c) Doesn't change. d) There's not sufficient information to tell.
The solution given is a), the temperature increases. But how would we know that the work done on the gas is not transferred to mechanical potential energy in the form of an increase in pressure of the gas?