示例#1
0
def test_is_valid_inchi():
    """Test if strings are correctly classified."""
    inchi_true = [
        "InChI=1S/C2H7N3/c1-5-2(3)4/h1H3,(H4,3,4,5)",
        '"InChI=1S/C2H7N3/c1-5-2(3)4/h1H3,(H4,3,4,5)"'
    ]
    inchi_false = [
        "1S/C2H7N3/c1-5-2(3)4/h1H3,(H4,3,4,5)",
        "InChI=1S/C2H7N3/c152(3)4/h1H3,(H4,3,4,5)",
        "InChI=C2H7N3/c1-5-2(3)4/h1H3,(H4,3,4,5)", "InChI=1S/C2H7N3/c1-5-2(3)"
    ]

    for inchi in inchi_true:
        assert is_valid_inchi(inchi), "Expected inchi is True."
    for inchi in inchi_false:
        assert not is_valid_inchi(inchi), "Expected inchi is False."
示例#2
0
def test_is_valid_inchi_none_input():
    """Test None entry."""
    pytest.importorskip("rdkit")

    assert not is_valid_inchi(None), "Expected None entry to give False."
示例#3
0
def test_is_valid_inchi_none_input():
    """Test None entry."""
    assert not is_valid_inchi(None), "Expected None entry to give False."