def test3_string2hash(self): """ queue._string2hash() """ assert queue._string2hash('a1\ta2\nb1\tb2') == {'a1': 'a2', 'b1': 'b2'} assert queue._string2hash('a1\x5c\ta2\nb1\tb2\\') == \ {'a1\x5c': 'a2', 'b1': 'b2\\'} for value in ['a', ]: self.failUnlessRaises(queue.QueueError, queue._string2hash, (value))
def test3_string2hash(self): """ queue._string2hash() """ assert queue._string2hash('a1\ta2\nb1\tb2') == {'a1': 'a2', 'b1': 'b2'} assert queue._string2hash('a1\x5c\ta2\nb1\tb2\\') == \ {'a1\x5c': 'a2', 'b1': 'b2\\'} for value in [ 'a', ]: self.failUnlessRaises(queue.QueueError, queue._string2hash, (value))
def test3_hash2string2hash(self): """ queue._hash2string()+queue._string2hash() """ example = {"hi\\t\th\nere": "h\\ello\twor\nld"} converted = queue._hash2string(example) assert converted == "hi\\\\t\\th\\nere\th\\\\ello\\twor\\nld\n" back = queue._string2hash(converted) assert back == example