示例#1
0
def test_dict_contains_contains_call(mocker):

    dct_contains = {'test_key': 'test_value'}
    keys_list_dct_contains = ['test_key']
    utils.dict_contains(dct_contains, keys_list_dct_contains)

    mocker.assert_called_once_with(dct_contains.keys(), keys_list_dct_contains)
示例#2
0
文件: predict.py 项目: pskshyam/NLP
    def _validate_model_config(req, resp, resource, params):
        """

        :param resp:
        :param resource:
        :param params:
        :return:
        """
        doc = req.params
        mandatory_fields = ["data"]
        assert dict_contains(doc,
                             mandatory_fields) is True, Predict._bad_request()
示例#3
0
文件: inspect.py 项目: pskshyam/NLP
    def _validate_model_config(req, resp, resource, params):
        """

        :param resp:
        :param resource:
        :param params:
        :return:
        """
        doc = req.context['doc']
        mandatory_fields = ['service_id']
        assert dict_contains(doc,
                             mandatory_fields) is True, Status._bad_request()
示例#4
0
def test_dict_contains_not_types_keys():
    try:
        utils.dict_contains({}, 1.2)
    except AssertionError as exc:
        assert str(
            exc) == "dict_contains: keys should be of type list or string "
示例#5
0
def test_dict_contains_not_dict():
    try:
        utils.dict_contains([], [])
    except AssertionError as exc:
        assert str(exc) == "dict_contains: dct should be of type dict "