def test_ImgGen_NegativeTestSize():
    """
    Testing that the ImgGenerator function raises error if the test_size is 
    equal to zero or smaller
    """
    with pytest.raises(ValueError):
        X1, X2, Y1, Y2 = ImgGenerator(X, Y, HowMany=32, test_size=-2)
def test_ImgGen_Normalized():
    """
    Testing the ImgGenerator function raises error if normalized is False but
    the datasets are actually normalized
    """
    with pytest.raises(ValueError):
        X1, X2, Y1, Y2 = ImgGenerator(X, Y, HowMany=4, normalized=False)
def test_ImgGen_Warning():
    """
    Test that the ImgGenerator function gives a Warning if the test_size
    is greater than 0.5 (but less than one)
    """
    with pytest.warns(Warning):
        X1, X2, Y1, Y2 = ImgGenerator(X, Y, HowMany=5, test_size=0.6)
def test_ImgGen_TooBigTestSize():
    """
    Testing that the ImgGenerator function raises error if the test_size is
    equal to one or greater
    """
    with pytest.raises(ValueError):
        X1, X2, Y1, Y2 = ImgGenerator(X, Y, HowMany=5, test_size=1)
def test_ImgGen_NegativeHowMany():
    """
    Testing that the ImgGenerator function raises an error if HowMany, i.e. 
    the number of picture to generate, is negative
    """
    with pytest.raises(ValueError):
        X1, X2, Y1, Y2 = ImgGenerator(X, Y, HowMany=-2)
def test_ImgGen_TooBigHowMany():
    """
    Testing that the ImgGenerator function raises an error if HowMany, i.e. 
    the number of picture to generate, is greater than the lenght of the
    given dataset
    """
    with pytest.raises(ValueError):
        X1, X2, Y1, Y2 = ImgGenerator(X, Y, HowMany=9000)
def test_ImgGen_NotNormalized():
    """
    Testing that the ImgGenerator function raises error if normalized is True
    but the datasets are not normalized
    """
    with pytest.raises(ValueError):
        X1, X2, Y1, Y2 = ImgGenerator(X_notnorm,
                                      Y_notnorm,
                                      HowMany=7,
                                      normalized=True)
def test_ImgGen_ReasonableHowMAny():
    """
    Testing ImgGenerator with default parameters and a number of pictures to generate
    between 0 and the lenght of the dataset
    """
    X1, X2, Y1, Y2 = ImgGenerator(X, Y, HowMany=15)
    assert len(X1) == len(Y1)
    assert len(X2) == len(Y2)
    assert (len(X1) + len(X2)) == (len(X) + 15)
    assert isinstance(X1, np.ndarray) and isinstance(
        X2, np.ndarray) and isinstance(Y1, np.ndarray) and isinstance(
            Y2, np.ndarray)