Ejemplo n.º 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)
Ejemplo n.º 2
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)
Ejemplo n.º 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))