test_dict.py 769 B

12345678910111213141516171819202122
  1. # Copyright (c) Twisted Matrix Laboratories.
  2. # See LICENSE for details.
  3. from twisted.trial import unittest
  4. from twisted.protocols import dict
  5. paramString = b"\"This is a dqstring \\w\\i\\t\\h boring stuff like: \\\"\" and t\\hes\\\"e are a\\to\\ms"
  6. goodparams = [b"This is a dqstring with boring stuff like: \"", b"and", b"thes\"e", b"are", b"atoms"]
  7. class ParamTests(unittest.TestCase):
  8. def testParseParam(self):
  9. """Testing command response handling"""
  10. params = []
  11. rest = paramString
  12. while 1:
  13. (param, rest) = dict.parseParam(rest)
  14. if param == None:
  15. break
  16. params.append(param)
  17. self.assertEqual(params, goodparams)#, "DictClient.parseParam returns unexpected results")