Beispiel #1
0
    def test_hyphenation_found(self, mock_api_call):
        res = [{
            "seq": 0,
            "type": "secondary stress",
            "text": "hip"
        }, {
            "seq": 1,
            "text": "po"
        }]

        mock_api_call.return_value = mock.Mock()
        mock_api_call.return_value.status_code = 200
        mock_api_call.return_value.json.return_value = res

        expected_result = '[{"seq": 0, "text": "hip", "type": "secondary stress"}, {"seq": 1, "text": "po"}]'
        result = vb.hyphenation("hippopotamus")

        if sys.version_info[:2] <= (2, 7):
            self.assertItemsEqual(expected_result, result)
        else:
            self.assertCountEqual(expected_result, result)
Beispiel #2
0
    def test_hyphenation_not_found(self, mock_api_call):
        mock_api_call.return_value = mock.Mock()
        mock_api_call.return_value.status_code = 404

        self.assertFalse(vb.hyphenation("hippopotamus"))