예제 #1
0
파일: tests.py 프로젝트: 0Chuzz/dzentools
 def test_unicode_output(self):
     elm = BarElement()
     elm.update = lambda: u'garçon'
     try:
         self.assertEqual(elm.next(), u'garçon'.encode('utf-8'))
     except UnicodeError:
         self.fail('error in unicode handling')
예제 #2
0
파일: tests.py 프로젝트: 0Chuzz/dzentools
 def test_update(self):
     def updatefunc(static=[0]):
         static[0] += 1
         return "update("+str(static[0])+")"
     elm = BarElement()
     elm.update = Mock(wraps=updatefunc)
     self.assertEqual(elm.next(),"update(1)")
     self.assertEqual(elm.next(),"update(2)")
     self.assertEqual(elm.next(),"update(3)")
예제 #3
0
파일: tests.py 프로젝트: 0Chuzz/dzentools
 def test_graceful_fail(self):
     def wrongfunc():
         raise StandardError
     elm = BarElement()
     elm.update = wrongfunc
     try:
         failed_update = elm.next()
     except StandardError:
         self.fail("uncaught error, no graceful fail")
     else:
         self.assertTrue("Error" in failed_update)
예제 #4
0
파일: tests.py 프로젝트: 0Chuzz/dzentools
 def test_iterable(self):
     elm = BarElement()
     def multi_iter(static=["1", "2", "3", None]):
         return static.pop(0)
     elm.update = multi_iter
     self.assertEqual(list(elm), ["1", "2", "3"])
예제 #5
0
파일: tests.py 프로젝트: 0Chuzz/dzentools
 def test_fixed_size(self):
     elm = BarElement(size=10)
     elm.update = Mock(return_value="testresult123456")
     self.assertEqual(elm.next(),"testresult")
예제 #6
0
파일: tests.py 프로젝트: 0Chuzz/dzentools
 def test_scrolling(self):
     elm = BarElement(size=3, scroll=1)
     elm.update = lambda: "1234"
     self.assertEqual(elm.next(), "123")
     self.assertEqual(elm.next(), "234")