#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright 2018 University of Groningen

# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""
These tests make sure the appropriate errors get raised.
"""
import pytest

from hypothesis_networkx import graph_builder

# Pylint doesn't like hypothesis
# pylint: disable=no-member, no-value-for-parameter

def test_min_nodes():
    """
    Make sure min_nodes is positive.
    """
    builder = graph_builder(min_nodes=-5)
    with pytest.raises(ValueError):
        builder.example()


def test_min_max_nodes():
    """
    Make sure min_nodes <= max_nodes
    """
    builder = graph_builder(min_nodes=10, max_nodes=5)
    with pytest.raises(ValueError):
        builder.example()


def test_max_edges():
    """
    Make sure that max_edges is large enough to not conflict with connected=True
    """
    builder = graph_builder(max_nodes=5, connected=True, max_edges=2)
    with pytest.raises(ValueError):
        builder.example()
