• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python server_support.print_error_log函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中server_support.print_error_log函数的典型用法代码示例。如果您正苦于以下问题:Python print_error_log函数的具体用法?Python print_error_log怎么用?Python print_error_log使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了print_error_log函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: test_prop_doesnt_exist

def test_prop_doesnt_exist():
    """Should return original JSON when prop doesn't exist."""
    x = {"aaa": "BBB"}
    r, c = _get_server_response(json.dumps(x), 'aaa%2Fddd')
    pinfo(x,r,c)
    print_error_log()
    assert_same_jsons(c, x)
开发者ID:amber-reichert,项目名称:ingestion,代码行数:7,代码来源:test_cleanup_value.py


示例2: test_populating_publisher_field

def test_populating_publisher_field():
    INPUT = {
            "freetext": {
                "publisher": [
                    {
                        "#text": "Glossary of Coins and Currency Terms",
                        "@label": "Publication title"
                        },
                    {
                        "#text": "http://americanhistory.si.edu/coins/glossary.cfm",
                        "@label": "Publication URL"
                        },
                    {
                        "#text": "xx",
                        "@label": "Publisher"
                        }
                    ],
                }
            }
    EXPECTED_PUBLISHER = {
            "publisher": ["xx"]
    }
    resp, content = _get_server_response(INPUT)
    print_error_log()
    assert resp["status"].startswith("2")
    CONTENT = json.loads(content)
    pinfo(content)

    assert_same_jsons(EXPECTED_PUBLISHER, CONTENT["sourceResource"])
开发者ID:amber-reichert,项目名称:ingestion,代码行数:29,代码来源:test_edan_to_dpla.py


示例3: test_not_remove_valid_date_dict

def test_not_remove_valid_date_dict():
    INPUT = {
            "sourceResource": {
                "date":
                    {
                        "begin": "1959-01-01",
                        "end": "1959-01-01",
                        "displayDate": "1959-01-01"
                        },
                    }
            }
    EXPECTED_OUTPUT = {
            "sourceResource": {
                "date":
                {
                    "begin": "1959-01-01",
                    "end": "1959-01-01",
                    "displayDate": "1959-01-01"
                    },
                }
            }
    resp, content = _get_server_response(INPUT)
    print_error_log()
    assert resp["status"].startswith("2")
    assert_same_jsons(EXPECTED_OUTPUT, content)
开发者ID:dpla,项目名称:ingestion,代码行数:25,代码来源:test_dc_clean_invalid_dates.py


示例4: test_substitute_with_list_of_dictionaries

def test_substitute_with_list_of_dictionaries():
    """
    Should convert all dicts in a list.
    """
    data = {
                "xxx": "yyy",
                "aaa": {
                    "bbb": "ccc",
                    "xxx": [
                        {"eee": "aaa"},
                        {"xxx": "eee"},
                        {"eee": "bbb"}
                    ]
                }
    }

    INPUT = json.dumps(data)
    data["aaa"]["xxx"] = [
                        {"eee": "AAA222"},
                        {"xxx": "eee"},
                        {"eee": "BBB222"},
    ]

    EXPECTED_OUTPUT = json.dumps(data)
    resp, content = _get_server_response(INPUT, "aaa/xxx/eee", "aaa/xxx/eee", "test2")
    print_error_log()
    pinfo(resp, content)

    assert resp.status == 200
    assert_same_jsons(content, EXPECTED_OUTPUT)
开发者ID:eldios,项目名称:ingestion,代码行数:30,代码来源:test_lookup.py


示例5: test_contentdm_identify_object_without_download

def test_contentdm_identify_object_without_download():
    """
    Should add a thumbnail URL made of the source URL.
    """
    INPUT = {
            u"something": "x",
            u"somethink": "y",
            u"originalRecord":
                    {"handle":
                        ["aaa", "http://repository.clemson.edu/u?/scp,104"]
                    },
            u"left": "right now!"
    }
    EXPECTED = {
            u"something": "x",
            u"somethink": "y",
            u"originalRecord": {
                "handle":
                    ["aaa", "http://repository.clemson.edu/u?/scp,104"]
                },
            u"object": ("http://repository.clemson.edu/cgi-bin/" +
                        "thumbnail.exe?CISOROOT=/scp&CISOPTR=104"),
            u"admin": {u"object_status": 0},
            u"left": "right now!"
    }
    url = contentdm_url("False")
    resp, content = H.request(url, "POST", body=json.dumps(INPUT))
    print_error_log()
    assert str(resp.status).startswith("2")
    result = json.loads(content)

    assert_same_jsons(EXPECTED, result)
开发者ID:amber-reichert,项目名称:ingestion,代码行数:32,代码来源:test_contentdm_identify_object.py


示例6: test_substitution_using_scdl_format_dict

def test_substitution_using_scdl_format_dict():
    formats = \
        ("Pamphlets", "Pamphlets"), \
        ("Pamphlet", "Pamphlets"), \
        ("pamphlets", "Pamphlets"), \
        ("Manuscripts", "Manuscripts"), \
        ("Manuscript", "Manuscripts"), \
        ("manuscripts", "Manuscripts"), \
        ("Photograph", "Photographs"), \
        ("Photographs", "Photographs"), \
        ("Photograph", "Photographs") \

    data = {
                "xxx": "yyy",
                "aaa": ""
    }

    for f in formats:
        data["aaa"] = f[0]
        INPUT = json.dumps(data)
        data["aaa"] = f[1]
        EXPECTED_OUTPUT = json.dumps(data)
        print "Checking: %s" + repr(f)
        resp, content = _get_server_response(INPUT, "aaa", "aaa", "scdl_fix_format", None, False)
        print_error_log()
        assert resp.status == 200
        assert_same_jsons(EXPECTED_OUTPUT, content)
开发者ID:amber-reichert,项目名称:ingestion,代码行数:27,代码来源:test_lookup.py


示例7: test_year_month

def test_year_month():
    """Should recognize YYYY-MM and not YYYY-YY"""
    INPUT = [
        "1940/2",
        "1940/02",
        "1940 / 2",
        "1940 / 02",
        "1940-2",
        "1940-02",
        "1940 - 2",
        "1940 - 02",
        "2/1940",
        "02/1940",
        "2 / 1940",
        "02 / 1940",
        "2-1940",
        "02-1940",
        "2 - 1940",
        "02 - 1940",
    ]

    url = server() + "enrich_earliest_date?prop=date"
    for date in INPUT:
        d = "1940-02"
        input = {"date": date}
        expected = {"date": {"begin": d, "end": d, "displayDate": date}}

        resp, content = H.request(url, "POST", body=json.dumps(input))
        print_error_log()
        assert str(resp.status).startswith("2")
        assert_same_jsons(expected, content)
开发者ID:peterkingalex,项目名称:ingestion,代码行数:31,代码来源:test_enrich_date.py


示例8: test_suppress_creator_value_for_string

def test_suppress_creator_value_for_string():
    """Should remove creator value if the is 'creator'."""
    INPUT = {
        "sourceResource": {
            "creator": "creator",
            "aaa": [
                "Fisker, Kay--Architect--Danish--Male",
                "Fisker, Kay--Architect--Danish--Male",
                "bbb",
                "ccc"
            ]
        }
    }
    EXPECTED_OUTPUT = {
        "sourceResource": {
            "aaa": [
                "Fisker, Kay--Architect--Danish--Male",
                "Fisker, Kay--Architect--Danish--Male",
                "bbb",
                "ccc"
            ]
        }
    }
    resp, content = _get_server_response(json.dumps(INPUT))
    print_error_log()
    assert resp["status"].startswith("2")
    assert_same_jsons(EXPECTED_OUTPUT, content)
开发者ID:amber-reichert,项目名称:ingestion,代码行数:27,代码来源:test_mwdl_cleanup_field.py


示例9: test_iso639_3_substitution

def test_iso639_3_substitution():
    """
    Should add "name" to language
    """
    INPUT = {
        "sourceResource": {
            "language": [
                {"iso639_3": "eng"},
                {"iso639_3": "ara"}
            ]
        }
    }
    EXPECTED = {
        "sourceResource": {
            "language": [
                {"iso639_3": "eng", "name": "English"},
                {"iso639_3": "ara", "name": "Arabic"}
            ]
        }
    }

    prop = "sourceResource%2Flanguage%2Fiso639_3"
    targ = "sourceResource%2Flanguage%2Fname"
    subs = "iso639_3"
    resp, content = _get_server_response(json.dumps(INPUT), prop, targ, subs)
    print_error_log()
    assert resp.status == 200
    assert_same_jsons(content, EXPECTED)
开发者ID:amber-reichert,项目名称:ingestion,代码行数:28,代码来源:test_lookup.py


示例10: test_removing_multiple_invalid_date_dicts

def test_removing_multiple_invalid_date_dicts():
    INPUT = {
            "sourceResource": {
                "date": [
                    {
                        "begin": "1959-01-01",
                        "end": "1959-01-01",
                        "displayDate": "1959-01-01"
                        },
                    {
                        "begin": "2008-11-18",
                        "end": "2008-11-18",
                        "displayDate": "2008-11-18"
                        },
                    {
                        "begin": "1959-01-01",
                        "end": None,
                        "displayDate": "1959-01-01"
                        },
                    {
                        "begin": "2008-11-18",
                        "end": "",
                        "displayDate": "2008-11-18"
                        },
                    {
                        "begin": None,
                        "end": "1959-01-01",
                        "displayDate": "1959-01-01"
                        },
                    {
                        "begin": "",
                        "end": "2008-11-18",
                        "displayDate": "2008-11-18"
                        },
                    "aaa",
                    "bbb",
                    "ccc",
                    ]
                }
            }
    EXPECTED_OUTPUT = {
            "sourceResource": {
                "date": [
                    {
                        "begin": "1959-01-01",
                        "end": "1959-01-01",
                        "displayDate": "1959-01-01",
                        },
                    {
                        "begin": "2008-11-18",
                        "end": "2008-11-18",
                        "displayDate": "2008-11-18"
                        },
                    ]
                }
            }
    resp, content = _get_server_response(INPUT, "sourceResource/date")
    print_error_log()
    assert resp["status"].startswith("2")
    assert_same_jsons(EXPECTED_OUTPUT, content)
开发者ID:dpla,项目名称:ingestion,代码行数:60,代码来源:test_dc_clean_invalid_dates.py


示例11: test_cleanup_value_for_list

def test_cleanup_value_for_list():
    INPUT = {
        "aaa": {
            "bbb": [
                "Fisker, Kay--Architect--Danish--Male",
                "Fisker, Kay--Architect--Danish--Male",
                "bbb",
                "ccc"
            ]
        }
    }
    EXPECTED_OUTPUT = {
        "aaa": {
            "bbb": [
                "Fisker, Kay",
                "Fisker, Kay",
                "bbb",
                "ccc"
            ]
        }
    }
    resp, content = _get_server_response(json.dumps(INPUT), "aaa/bbb")
    print_error_log()
    assert resp["status"].startswith("2")
    assert_same_jsons(EXPECTED_OUTPUT, content)
开发者ID:amber-reichert,项目名称:ingestion,代码行数:25,代码来源:test_mwdl_cleanup_field.py


示例12: test_georgia_set_spec_type

def test_georgia_set_spec_type():
    """Should set the specType to include Book, Government Document,
       and Serial
    """
    INPUT = {
        "sourceResource": {
            "type": [
                "something Books",
                " GOVERNMENT something",
                " Something periodicals",
                " Another periodicals"
            ]
        }
    }
    EXPECTED = {
        "sourceResource": {
            "type": [
                "something Books",
                " GOVERNMENT something",
                " Something periodicals",
                " Another periodicals"
            ],
            "specType": [
                "Book",
                "Government Document",
                "Serial"
            ]
        }
    }

    resp, content = _get_server_response(json.dumps(INPUT))
    print_error_log()
    assert resp["status"] == "200"
    assert_same_jsons(EXPECTED, json.loads(content))
开发者ID:peterkingalex,项目名称:ingestion,代码行数:34,代码来源:test_georgia_set_spec_type.py


示例13: test_unset_prop2

def test_unset_prop2():
    """Should unset prop since condition is met"""
    action = "unset"
    prop = "sourceResource/rights"
    condition = "is_digit"

    INPUT = {
        "_id": "12345",
        "key1": "value1",
        "sourceResource": {
            "key1" : "value1",
            "rights": "20010983784"
        },
        "key2": "value2"
    }
    EXPECTED = {
        "_id": "12345",
        "key1": "value1",
        "sourceResource": {
            "key1" : "value1"
        },
        "key2": "value2"
    }

    resp,content = _get_server_response(json.dumps(INPUT), action=action,
        prop=prop, condition=condition)
    assert resp.status == 200
    print_error_log()
    assert json.loads(content) == EXPECTED
开发者ID:amber-reichert,项目名称:ingestion,代码行数:29,代码来源:test_set_prop.py


示例14: test_range_with_brackets

def test_range_with_brackets():
    """Should transform date range with brackets."""

    ranges = [
            ("1960-05-01 - 1960-05-15",     "1960-05-01 - 1960-05-15"),
            ("[ 1960-05-01 - 1960-05-15 ]", "1960-05-01 - 1960-05-15"),
            ("[1960-05-01 - 1960-05-15]",   "1960-05-01 - 1960-05-15"),
            ("[1960-05-01 / 1960-05-15]",   "1960-05-01 / 1960-05-15"),
            ("[1960-05-01/1960-05-15]",   "1960-05-01/1960-05-15"),
    ]

    for r in ranges:
        INPUT = {"date": r[0]}
        EXPECTED = {
            u'date' : {
                u'begin' : u'1960-05-01',
                u'end' : u'1960-05-15',
                "displayDate" : r[1]
            }
        }

        url = server() + "enrich_earliest_date?prop=date"

        resp, content = H.request(url, "POST", body=json.dumps(INPUT))
        assert str(resp.status).startswith("2")
        print_error_log()
        assert_same_jsons(EXPECTED, content)
开发者ID:chadfennell,项目名称:ingestion,代码行数:27,代码来源:test_enrich_date.py


示例15: test_contentdm_identify_object_usc

def test_contentdm_identify_object_usc():
    """
    Should add a thumbnail URL made of the source URL.
    """
    INPUT = {
            u"something": "x",
            u"somethink": "y",
            u"originalRecord":
                    {"handle":
                        ["aaa", "http://some.url/cdm/ref/12345"]
                    },
            u"left": "right now!"
    }
    EXPECTED = {
            u"something": "x",
            u"somethink": "y",
            u"originalRecord": {
                "handle":
                    ["aaa", "http://some.url/cdm/ref/12345"]
                },
            u"object": ("http://some.url/utils/getthumbnail/12345"),
            u"admin": {u"object_status": 0},
            u"left": "right now!"
    }
    url = contentdm_url("False")
    resp, content = H.request(url, "POST", body=json.dumps(INPUT))
    print_error_log()
    assert str(resp.status).startswith("2")
    result = json.loads(content)

    assert_same_jsons(EXPECTED, result)
开发者ID:amber-reichert,项目名称:ingestion,代码行数:31,代码来源:test_contentdm_identify_object.py


示例16: test_unset_prop6

def test_unset_prop6():
    """Should unset prop since conditions are met for multiple condition
       props"""
    action = "unset"
    prop = "_id"
    condition = "hathi_exclude"
    condition_prop = "dataProvider%2CsourceResource%2Ftype"

    INPUT = {
        "_id": "12345",
        "dataProvider": ["Hathitrust", "University of Minnesota"],
        "sourceResource": {
            "type": "image"
        }
    }
    EXPECTED = {
        "dataProvider": ["Hathitrust", "University of Minnesota"],
        "sourceResource": {
            "type": "image"
        }
    }

    resp, content = _get_server_response(json.dumps(INPUT), action=action,
        prop=prop, condition=condition, condition_prop=condition_prop)
    print_error_log()
    assert resp.status == 200
    assert json.loads(content) == EXPECTED
开发者ID:amber-reichert,项目名称:ingestion,代码行数:27,代码来源:test_set_prop.py


示例17: test_description_transform1

def test_description_transform1():
    INPUT = {"metadata": {"mods": {"note": "A description"}}}
    EXPECTED = {"description": "A description"}

    resp, content = _get_server_response(json.dumps(INPUT), provider="HARVARD")
    print_error_log()
    assert resp.status == 200
    assert_same_jsons(EXPECTED, json.loads(content)["sourceResource"])
开发者ID:peterkingalex,项目名称:ingestion,代码行数:8,代码来源:test_oai_mods_to_dpla.py


示例18: test_thumbnail_url_prefix_NJP1

def test_thumbnail_url_prefix_NJP1():
    hathi_record = hathi_records["njp1"]
    thumbnail_url = "http://bks4.books.google.com/books?id=GswtcRL0tZ0C&printsec=frontcover&img=1&zoom=5"
    thumbnail_urls = [thumbnail_url, thumbnail_url + "&edge=curl"]

    resp, content = _get_server_response(json.dumps(hathi_record))
    print_error_log()
    assert resp.status == 200
    assert json.loads(content).get("object") in thumbnail_urls
开发者ID:dpla,项目名称:ingestion,代码行数:9,代码来源:test_hathi_identify_object.py


示例19: test_missing_value_in_dict

def test_missing_value_in_dict():
    """Should do nothing when there is no such value in dictionary."""
    INPUT = {"a": "b"}
    resp, content = _get_server_response(json.dumps(INPUT), "a", "x", "test")
    print_error_log()
    pinfo(resp, content)

    assert resp.status == 200
    assert_same_jsons(content, INPUT)
开发者ID:amber-reichert,项目名称:ingestion,代码行数:9,代码来源:test_lookup.py


示例20: test_thumbnail_url_prefix_UC1_UCSC3

def test_thumbnail_url_prefix_UC1_UCSC3():
    hathi_record = hathi_records["uc1_ucsc3"]
    thumbnail_url = "http://bks7.books.google.com/books?id=66C4AAAAIAAJ&printsec=frontcover&img=1&zoom=5"
    thumbnail_urls = [thumbnail_url, thumbnail_url + "&edge=curl"]

    resp, content = _get_server_response(json.dumps(hathi_record))
    print_error_log()
    assert resp.status == 200
    assert json.loads(content).get("object") in thumbnail_urls
开发者ID:dpla,项目名称:ingestion,代码行数:9,代码来源:test_hathi_identify_object.py



注:本文中的server_support.print_error_log函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python server_support.server函数代码示例发布时间:2022-05-27
下一篇:
Python server_pool.ServerPool类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap