Beispiel #1
0
def test_time_config_relative():
    expected = 100

    config = TimeConfig().with_range(expected)
    assert config.options['range'] == expected

    conf = TimeConfig().with_type(Time.Relative).with_range(expected)
    assert conf.options['range'] == expected
Beispiel #2
0
def test_time_config_absolute():
    e_start = 100
    e_end = 200

    config = TimeConfig().with_start(e_start).with_end(e_end)
    assert config.options['start'] == e_start
    assert config.options['end'] == e_end

    conf = TimeConfig().with_type(Time.Absolute)\
        .with_start(e_start).with_end(e_end)
    assert conf.options['start'] == e_start
    assert conf.options['end'] == e_end
Beispiel #3
0
def test_detector_with_visualization_options():
    opts = VisualizationOptions()\
        .with_time_config(TimeConfig().with_type(Time.Absolute))
    d = Detector().with_visualization_options(opts)
    assert d.options['visualizationOptions'] == opts.options
Beispiel #4
0
def test_vis_opts_time_config():
    conf = TimeConfig().with_type(Time.Relative).with_range(100)
    opts = VisualizationOptions().with_time_config(conf)

    assert opts.options['time'] == conf.options
Beispiel #5
0
def test_time_config_range_absolute():
    with pytest.raises(ValueError):
        TimeConfig().with_type(Time.Absolute).with_range(100)
Beispiel #6
0
def test_time_config_end_relative():
    with pytest.raises(ValueError):
        TimeConfig().with_type(Time.Relative).with_end(100)
Beispiel #7
0
def test_time_config_add_millis():
    expected = 100
    config = TimeConfig().__add_millis__(expected, 'foo')
    assert config.options['foo'] == expected
Beispiel #8
0
def test_time_config_with_type_invalid():
    with pytest.raises(ValueError):
        TimeConfig().with_type('lol')
Beispiel #9
0
def test_time_config_with_type():
    expected = Time.Relative
    config = TimeConfig().with_type(expected)
    assert config.options['type'] == expected.value
Beispiel #10
0
def test_time_config_init():
    assert TimeConfig().options == {}