예제 #1
0
 def test_respond_as_list_3(self):
     data = json.loads('{"text": ["hummus"]}')
     expected_result = ["hummus"]
     result = rp().respond(data, 'list')
     if sys.version_info[:2] <= (2, 7):
         self.assertItemsEqual(expected_result, result)
     else:
         self.assertCountEqual(expected_result, result)
예제 #2
0
 def test_respond_as_dict_1(self):
     data = json.loads('[{"text": "hummus", "seq": 0}]')
     expected_result = {0: {"text": "hummus"}}
     result = rp().respond(data, 'dict')
     if sys.version_info[:2] <= (2, 7):
         self.assertItemsEqual(expected_result, result)
     else:
         self.assertCountEqual(expected_result, result)
예제 #3
0
 def test_respond_as_list_2(self):
     data = json.loads(
         '[{"text": "hummus", "seq": 0},{"text": "hummusy", "seq": 1}]')
     expected_result = ["hummus", "hummusy"]
     result = rp().respond(data, 'list')
     if sys.version_info[:2] <= (2, 7):
         self.assertItemsEqual(expected_result, result)
     else:
         self.assertCountEqual(expected_result, result)