# Path: nomad/api/exceptions.py
# class BaseNomadException(Exception):
# class URLNotFoundNomadException(BaseNomadException):
# class URLNotAuthorizedNomadException(BaseNomadException):
# class BadRequestNomadException(BaseNomadException):
# class InvalidParameters(Exception):
# class TimeoutNomadException(requests.exceptions.RequestException):
#     def __init__(self, nomad_resp):
#     def __str__(self):


import os
import pytest
import uuid
from nomad.api import exceptions as nomad_exceptions
    nodeID = nomad_setup.nodes["pynomad1"]["ID"]
    assert "EvalIDs" in nomad_setup.node.drain_node(nodeID)
    assert "EvalIDs" in nomad_setup.node.drain_node(nodeID, True)
    assert nomad_setup.node[nodeID]["Drain"] is True
    nomad_setup.node.drain_node(nodeID)
    assert nomad_setup.node[nodeID]["Drain"] is False


@pytest.mark.skipif(tuple(int(i) for i in os.environ.get("NOMAD_VERSION").split(".")) < (0, 8, 1), reason="Not supported in version")
def test_drain_node_with_spec(nomad_setup):
    nodeID = nomad_setup.nodes["pynomad1"]["ID"]
    assert "EvalIDs" in nomad_setup.node.drain_node_with_spec(nodeID, drain_spec={"Duration": "-100000000"})
    assert nomad_setup.node[nodeID]["Drain"] is True
    assert "EvalIDs" in nomad_setup.node.drain_node_with_spec(nodeID, drain_spec={}, mark_eligible=True)
    assert nomad_setup.node[nodeID]["Drain"] is False


@pytest.mark.skipif(tuple(int(i) for i in os.environ.get("NOMAD_VERSION").split(".")) < (0, 8, 1), reason="Not supported in version")
def test_eligible_node(nomad_setup):
    nodeID = nomad_setup.nodes["pynomad1"]["ID"]

    nomad_setup.node.eligible_node(nodeID, ineligible=True)
    assert nomad_setup.node[nodeID]["SchedulingEligibility"] == "ineligible"

    nomad_setup.node.eligible_node(nodeID, eligible=True)
    assert nomad_setup.node[nodeID]["SchedulingEligibility"] == "eligible"

    with pytest.raises(nomad_exceptions.InvalidParameters):
        assert nomad_setup.node.eligible_node(nodeID, eligible=True, ineligible=True)


# Path: nomad/api/exceptions.py
# class BaseNomadException(Exception):
# class URLNotFoundNomadException(BaseNomadException):
# class URLNotAuthorizedNomadException(BaseNomadException):
# class BadRequestNomadException(BaseNomadException):
# class InvalidParameters(Exception):
# class TimeoutNomadException(requests.exceptions.RequestException):
#     def __init__(self, nomad_resp):
#     def __str__(self):


# Path: tests/test_node.py
import os
import pytest
import uuid
from nomad.api import exceptions as nomad_exceptions

    nodeID = nomad_setup.nodes["pynomad1"]["ID"]
    assert "EvalIDs" in nomad_setup.node.drain_node(nodeID)
    assert "EvalIDs" in nomad_setup.node.drain_node(nodeID, True)
    assert nomad_setup.node[nodeID]["Drain"] is True
    nomad_setup.node.drain_node(nodeID)
    assert nomad_setup.node[nodeID]["Drain"] is False


@pytest.mark.skipif(tuple(int(i) for i in os.environ.get("NOMAD_VERSION").split(".")) < (0, 8, 1), reason="Not supported in version")
def test_drain_node_with_spec(nomad_setup):
    nodeID = nomad_setup.nodes["pynomad1"]["ID"]
    assert "EvalIDs" in nomad_setup.node.drain_node_with_spec(nodeID, drain_spec={"Duration": "-100000000"})
    assert nomad_setup.node[nodeID]["Drain"] is True
    assert "EvalIDs" in nomad_setup.node.drain_node_with_spec(nodeID, drain_spec={}, mark_eligible=True)
    assert nomad_setup.node[nodeID]["Drain"] is False


@pytest.mark.skipif(tuple(int(i) for i in os.environ.get("NOMAD_VERSION").split(".")) < (0, 8, 1), reason="Not supported in version")
def test_eligible_node(nomad_setup):
    nodeID = nomad_setup.nodes["pynomad1"]["ID"]

    nomad_setup.node.eligible_node(nodeID, ineligible=True)
    assert nomad_setup.node[nodeID]["SchedulingEligibility"] == "ineligible"

    nomad_setup.node.eligible_node(nodeID, eligible=True)
    assert nomad_setup.node[nodeID]["SchedulingEligibility"] == "eligible"

    with pytest.raises(nomad_exceptions.InvalidParameters):
        assert nomad_setup.node.eligible_node(nodeID, eligible=True, ineligible=True)


    with pytest.raises(nomad_exceptions.InvalidParameters):