7629: TR2i coverage and corrections

@debugger22 pointed out the missing import. While writing tests
some corrections were made: the factoring should be done if there is
more than one term; the new value for the key must be put in ddone just
as it is put in d. Also, if k was deleted from d then the value is int 0
(because of as_powers_dict's default int value) so before checking in ok,
one has to be sure that what is sent is a SymPy object or else
e.is_integer will fail.
remove redundant import

[ci skip]
Merge pull request #7631 from smichr/fu

7629: TR2i coverage and corrections