Exemple #1
0
def test_allowed_tels_from_config():
    dataset = get_dataset_path("gamma_test_large.simtel.gz")
    config = Config({'EventSource': {
        'input_url': dataset,
        'allowed_tels': {1, 3}
    }})
    reader = EventSource.from_config(config=config, parent=None)
    assert len(reader.allowed_tels) == 2
def test_factory_allowed_tels_from_config():
    dataset = get_dataset_path("gamma_test_large.simtel.gz")
    config = Config({'EventSource': {
        'input_url': dataset,
        'allowed_tels': {1, 3}
    }})
    reader = EventSource.from_config(config=config, parent=None)
    assert len(reader.allowed_tels) == 2
Exemple #3
0
def test_from_config_default():
    old_default = EventSource.input_url.default_value
    dataset = get_dataset_path("gamma_test_large.simtel.gz")
    EventSource.input_url.default_value = dataset
    config = Config()
    reader = EventSource.from_config(config=config, parent=None)
    assert isinstance(reader, SimTelEventSource)
    assert reader.input_url == dataset
    EventSource.input_url.default_value = old_default
Exemple #4
0
def test_max_events_from_config():
    dataset = get_dataset_path("gamma_test_large.simtel.gz")
    max_events = 10
    config = Config({'EventSource': {
        'input_url': dataset,
        'max_events': max_events,
    }})
    reader = EventSource.from_config(config=config)
    assert reader.max_events == max_events
def test_factory_max_events_from_config():
    dataset = get_dataset_path("gamma_test_large.simtel.gz")
    max_events = 10
    config = Config({'EventSource': {
        'input_url': dataset,
        'max_events': max_events,
    }})
    reader = EventSource.from_config(config=config)
    assert reader.max_events == max_events
def test_from_config_default():
    old_default = EventSource.input_url.default_value
    dataset = get_dataset_path("gamma_test_large.simtel.gz")
    EventSource.input_url.default_value = dataset
    config = Config()
    reader = EventSource.from_config(config=config, parent=None)
    assert isinstance(reader, SimTelEventSource)
    assert reader.input_url == dataset
    EventSource.input_url.default_value = old_default
Exemple #7
0
def test_max_events_from_config():
    dataset = get_dataset_path("gamma_test_large.simtel.gz")
    max_events = 10
    config = Config(
        {"EventSource": {
            "input_url": dataset,
            "max_events": max_events
        }})
    reader = EventSource.from_config(config=config)
    assert reader.max_events == max_events
Exemple #8
0
def test_from_config_invalid_type():
    dataset = get_dataset_path("gamma_test_large.simtel.gz")
    EventSource.input_url.default_value = dataset
    config = Config({'EventSource': {'input_url': 124}})
    with pytest.raises(TraitError):
        EventSource.from_config(config=config, parent=None)
Exemple #9
0
def test_from_config():
    dataset = get_dataset_path("gamma_test_large.simtel.gz")
    config = Config({'EventSource': {'input_url': dataset}})
    reader = EventSource.from_config(config=config, parent=None)
    assert isinstance(reader, SimTelEventSource)
    assert reader.input_url == dataset
def test_from_config_invalid_type():
    dataset = get_dataset_path("gamma_test_large.simtel.gz")
    EventSource.input_url.default_value = dataset
    config = Config({'EventSource': {'input_url': 124}})
    with pytest.raises(TraitError):
        EventSource.from_config(config=config, parent=None)
def test_from_config():
    dataset = get_dataset_path("gamma_test_large.simtel.gz")
    config = Config({'EventSource': {'input_url': dataset}})
    reader = EventSource.from_config(config=config, parent=None)
    assert isinstance(reader, SimTelEventSource)
    assert reader.input_url == dataset