def test_timeOfDay(estimator) -> None:
    time: FakeTime = FakeTime()
    info = GlobalInfo(time)

    config: Config = Config()
    model: Model = Model(config, time, default_source, default_source, info,
                         estimator)
    assert model.getTimeOfDay() is None

    config = Config().override(Setting.SNAPSHOT_TIME_OF_DAY, '00:00')
    model = Model(config, time, default_source, default_source, info,
                  estimator)
    assert model.getTimeOfDay() == (0, 0)

    config.override(Setting.SNAPSHOT_TIME_OF_DAY, '23:59')
    model = Model(config, time, default_source, default_source, info,
                  estimator)
    assert model.getTimeOfDay() == (23, 59)

    config.override(Setting.SNAPSHOT_TIME_OF_DAY, '24:59')
    model = Model(config, time, default_source, default_source, info,
                  estimator)
    assert model.getTimeOfDay() is None

    config.override(Setting.SNAPSHOT_TIME_OF_DAY, '24:60')
    model = Model(config, time, default_source, default_source, info,
                  estimator)
    assert model.getTimeOfDay() is None

    config.override(Setting.SNAPSHOT_TIME_OF_DAY, '-1:60')
    model = Model(config, time, default_source, default_source, info,
                  estimator)
    assert model.getTimeOfDay() is None

    config.override(Setting.SNAPSHOT_TIME_OF_DAY, '24:-1')
    model = Model(config, time, default_source, default_source, info,
                  estimator)
    assert model.getTimeOfDay() is None

    config.override(Setting.SNAPSHOT_TIME_OF_DAY, 'boop:60')
    model = Model(config, time, default_source, default_source, info,
                  estimator)
    assert model.getTimeOfDay() is None

    config.override(Setting.SNAPSHOT_TIME_OF_DAY, '24:boop')
    model = Model(config, time, default_source, default_source, info,
                  estimator)
    assert model.getTimeOfDay() is None

    config.override(Setting.SNAPSHOT_TIME_OF_DAY, '24:10:22')
    model = Model(config, time, default_source, default_source, info,
                  estimator)
    assert model.getTimeOfDay() is None

    config.override(Setting.SNAPSHOT_TIME_OF_DAY, '10')
    model = Model(config, time, default_source, default_source, info,
                  estimator)
    assert model.getTimeOfDay() is None
Exemple #2
0
def test_timeOfDay(estimator, model: Model) -> None:
    assert model.getTimeOfDay() is None

    model.config.override(Setting.SNAPSHOT_TIME_OF_DAY, '00:00')
    model.reinitialize()
    assert model.getTimeOfDay() == (0, 0)

    model.config.override(Setting.SNAPSHOT_TIME_OF_DAY, '23:59')
    model.reinitialize()
    assert model.getTimeOfDay() == (23, 59)

    model.config.override(Setting.SNAPSHOT_TIME_OF_DAY, '24:59')
    model.reinitialize()
    assert model.getTimeOfDay() is None

    model.config.override(Setting.SNAPSHOT_TIME_OF_DAY, '24:60')
    model.reinitialize()
    assert model.getTimeOfDay() is None

    model.config.override(Setting.SNAPSHOT_TIME_OF_DAY, '-1:60')
    model.reinitialize()
    assert model.getTimeOfDay() is None

    model.config.override(Setting.SNAPSHOT_TIME_OF_DAY, '24:-1')
    model.reinitialize()
    assert model.getTimeOfDay() is None

    model.config.override(Setting.SNAPSHOT_TIME_OF_DAY, 'boop:60')
    model.reinitialize()
    assert model.getTimeOfDay() is None

    model.config.override(Setting.SNAPSHOT_TIME_OF_DAY, '24:boop')
    model.reinitialize()
    assert model.getTimeOfDay() is None

    model.config.override(Setting.SNAPSHOT_TIME_OF_DAY, '24:10:22')
    model.reinitialize()
    assert model.getTimeOfDay() is None

    model.config.override(Setting.SNAPSHOT_TIME_OF_DAY, '10')
    model.reinitialize()
    assert model.getTimeOfDay() is None