def test_filter_by_conditional_statement_continuous(): """Test filter by conditional statement.""" header1 = Header(Temperature(), 'C', AnalysisPeriod(end_month=1, end_day=2)) values = list(xrange(48)) dc1 = HourlyContinuousCollection(header1, values) dc2 = dc1.filter_by_conditional_statement('a > 23') assert len(dc2) == 24 for d in dc2.values: assert d > 23 assert not isinstance(dc2, HourlyContinuousCollection)
def test_hourlyplot_conditional_statement(): """Test the initialization of HourlyPlot with a conditional statement.""" header = Header(Temperature(), 'C', AnalysisPeriod()) values = list(range(8760)) data_coll = HourlyContinuousCollection(header, values) data_coll = data_coll.filter_by_conditional_statement('a >= 60') hour_plot = HourlyPlot(data_coll, y_dim=1) mesh = hour_plot.colored_mesh2d assert len(mesh.faces) == 8700 assert mesh.min == Point2D(0, 0) assert mesh.max == Point2D(365, 24)