コード例 #1
0
def test__MeasurementQuery__is_consumption__Measurement_exists__returns_correct_Measurements(seeded_session):
    query = MeasurementQuery(seeded_session) \
        .is_consumption()

    assert query.count() > 0
    assert all(m.type == MeasurementType.CONSUMPTION for m in query.all())
コード例 #2
0
def test__MeasurementQuery__is_published__Measurement_exists__returns_correct_Measurements(seeded_session, is_published):
    query = MeasurementQuery(seeded_session) \
        .is_published(is_published)

    assert query.count() > 0
    assert all(m.published == is_published for m in query.all())
コード例 #3
0
def test__MeasurementQuery__is_type__Measurement_exists__returns_correct_Measurements(seeded_session, type):
    query = MeasurementQuery(seeded_session) \
        .is_type(type)

    assert query.count() > 0
    assert all(m.type == type for m in query.all())
コード例 #4
0
def test__MeasurementQuery__has_any_gsrn__Measurement_exists__returns_correct_Measurements(seeded_session, gsrn):
    query = MeasurementQuery(seeded_session) \
        .has_any_gsrn(gsrn)

    assert query.count() > 0
    assert all(m.gsrn in gsrn for m in query.all())
コード例 #5
0
def test__MeasurementQuery__begins_within__returns_correct_measurements(seeded_session, begin, end):
    query = MeasurementQuery(seeded_session) \
        .begins_within(DateTimeRange(begin=begin, end=end))

    assert query.count() > 0
    assert all(begin <= m.begin <= end for m in query.all())
コード例 #6
0
def test__MeasurementQuery__begins_at__returns_correct_measurements(seeded_session, begin):
    query = MeasurementQuery(seeded_session) \
        .begins_at(begin)

    assert query.count() > 0
    assert all(m.begin == begin for m in query.all())
コード例 #7
0
def test__MeasurementQuery__belongs_to__returns_correct_measurements(seeded_session, sub):
    query = MeasurementQuery(seeded_session) \
        .belongs_to(sub)

    assert query.count() > 0
    assert all(m.sub == sub for m in query.all())