示例#1
0
def test_random_name():
    p = random_name(gender='female', region='canada')
    assert len(p) > 3
    assert ', ' in p
    with pytest.raises(ValueError) as excinfo:
        random_name(gender='fjweiuw', region='canada')
    assert "{'error': 'Invalid gender'}" in str(excinfo.value)
def test_random_name():
    p = random_name(gender='female', region='canada')
    assert (len(p) > 3)
    assert (', ' in p)
    with pytest.raises(ValueError) as excinfo:
        random_name(gender='fjweiuw', region='canada')
    assert '{"error":"Invalid gender"}' in str(excinfo.value)
示例#3
0
def test_random_name():
    p = random_name(gender='female', region='canada')
    assert isinstance(p, str)
    assert len(p) > 3
    assert ', ' in p
    with pytest.raises(ValueError) as excinfo:
        random_name(gender='fjweiuw', region='canada')
    assert re.match(r'{"error":\s*"Invalid gender"}', str(excinfo.value))