Changeset 9126 for main/waeup.kofa/trunk/src
- Timestamp:
- 30 Aug 2012, 08:11:58 (12 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/objecthistory.py
r9125 r9126 98 98 """ 99 99 msgs = self._getMessages() 100 if not isinstance(number, int): 101 return False, 'Not a number' 102 try: 103 line = msgs[number] 104 except IndexError: 105 return False, 'Number out of range' 100 106 msgs.pop(number) 101 107 self._annotations[self.history_key] = msgs 102 return 108 return True, line -
main/waeup.kofa/trunk/src/waeup/kofa/tests/test_objecthistory.py
r9125 r9126 108 108 hist.addMessage('blah') 109 109 hist.addMessage('blow') 110 self.assertEqual(len(hist._getMessages()), 2)110 self.assertEqual(len(hist._getMessages()), 2) 111 111 result = ' '.join(hist.messages) 112 112 self.assertTrue('blah by Bob' in result) 113 113 self.assertTrue('blow by Bob' in result) 114 hist.removeMessage(1) 115 self.assertEqual(len(hist._getMessages()),1) 114 success, text = hist.removeMessage('xyz') 115 self.assertFalse(success) 116 self.assertEqual(text, 'Not a number') 117 success, text = hist.removeMessage(100) 118 self.assertFalse(success) 119 self.assertEqual(text, 'Number out of range') 120 success, text = hist.removeMessage(1) 121 self.assertTrue(success) 122 self.assertMatches('<YYYY-MM-DD hh:mm:ss> UTC - blow by Bob', text) 123 self.assertEqual(len(hist.messages), 1) 116 124 result = ' '.join(hist.messages) 117 125 self.assertFalse('blow by Bob' in result)
Note: See TracChangeset for help on using the changeset viewer.