TST: add tests for algos.factorize (GH6212)

tests for issues in #6212 / #6231