TST: fix broken test case on py3 and add assertRaises #3179