You haveYou've misunderstood the algorithm and it doesn't have the behaviour you suggest. It
Let the pivot value be $p$. The algorithm searches from the left of the array for something bigger than the pivota value $\ell\geq p$ and from the right of the array for something less than the pivota value $r\leq p$. It then only exchangesswaps them if it finds two values of that formthey're in the wrong order relative to each other, i. As suche., if $\ell>r$, so it will never exchange two identical array elements.
In your example, the algorithm would either swap the 1 on the left with the 7 on the right, or the 7 on the left with the 1 on the right, depending on exactly how it is implemented.