def test_num_epochs_value_error(synthetic_dataset, reader_factory):
    """Tests that the reader raises value errors when appropriate"""

    # Testing only Reader v1, as the v2 uses an epoch generator. The error would raise only when the generator is
    # evaluated. Parameter validation for Reader v2 is covered by test_epoch_generator.py

    with pytest.raises(ValueError):
        reader_factory(synthetic_dataset.url, num_epochs=-10)

    with pytest.raises(ValueError):
        reader_factory(synthetic_dataset.url, num_epochs='abc')
Tests that the reader raises value errors when appropriate
petastorm/tests/test_end_to_end.py