Add test for issue 5719, fixes #5719
Merge pull request #8231 from skirpichev/5719-fix

Add test for issue 5719
Merge https://github.com/sympy/sympy

Starting fresh