Fix tuple formatter test and add mainloop test.