def test_wrap(self): message.line_length = 5 # easy to construct expt result # functional check self.assertEquals(message.wrap("ab"), "-ab--\n") self.assertEquals(message.wrap("abc"), "-abc-\n") self.assertEquals(message.wrap(3), "--3--\n") self.assertEquals(message.wrap(34), "-34--\n") self.assertEquals(message.wrap(None), None) # bound check self.assertEquals(message.wrap("123456"), "123456\n") self.assertEquals(message.wrap("12345"), "12345\n") self.assertEquals(message.wrap("1234"), "1234-\n") self.assertEquals(message.wrap(123456), "123456\n") self.assertEquals(message.wrap(""), "-----\n")
def queryModel(): search_engine.load_idx() while True: try: word = input(message.wrap("Please enter the word('ctrl+c' to quit):")) except KeyboardInterrupt: quit() break show(search_engine.get_desc(word), line_break = True)
def quit(): print(message.wrap('bye'))