def test_copy_plot_limits(self): plot_limits = PlotLimits() plot_limits.value_limits = 1, 2 plot_limits.index_limits = 3, 4 plot_limits.count_limits = 5, 6 plot_limits.depth_limits = 7, 8 plot_limits.density_limits = 9, 10 plot_limits.date_limits = datetime.date(1999, 1, 1), datetime.date( 1999, 12, 31) copy_of_plot_limits = PlotLimits() copy_of_plot_limits.copyLimitsFrom(plot_limits) self.assertEqual(copy_of_plot_limits, plot_limits) self.assertEqual(copy_of_plot_limits.value_limits, (1, 2)) self.assertEqual(copy_of_plot_limits.index_limits, (3, 4)) self.assertEqual(copy_of_plot_limits.count_limits, (5, 6)) self.assertEqual(copy_of_plot_limits.depth_limits, (7, 8)) self.assertEqual(copy_of_plot_limits.density_limits, (9, 10)) self.assertEqual( copy_of_plot_limits.date_limits, (datetime.date(1999, 1, 1), datetime.date(1999, 12, 31)), )
def test_copy_plot_limits(self): plot_limits = PlotLimits() plot_limits.value_limits = 1, 2 plot_limits.index_limits = 3, 4 plot_limits.count_limits = 5, 6 plot_limits.depth_limits = 7, 8 plot_limits.density_limits = 9, 10 plot_limits.date_limits = datetime.date(1999, 1, 1), datetime.date(1999, 12, 31) copy_of_plot_limits = PlotLimits() copy_of_plot_limits.copyLimitsFrom(plot_limits) self.assertEqual(copy_of_plot_limits, plot_limits) self.assertEqual(copy_of_plot_limits.value_limits, (1, 2)) self.assertEqual(copy_of_plot_limits.index_limits, (3, 4)) self.assertEqual(copy_of_plot_limits.count_limits, (5, 6)) self.assertEqual(copy_of_plot_limits.depth_limits, (7, 8)) self.assertEqual(copy_of_plot_limits.density_limits, (9, 10)) self.assertEqual(copy_of_plot_limits.date_limits, (datetime.date(1999, 1, 1), datetime.date(1999, 12, 31)))
def test_plot_config(self): ps = PlotSettings() plot_config = PlotConfig(ps, "Golden Sample", x_label="x", y_label="y") limits = PlotLimits() limits.count_limits = 1, 2 limits.depth_limits = 3, 4 limits.density_limits = 5, 6 limits.date_limits = datetime.date(2005, 2, 5), datetime.date(2006, 2, 6) limits.index_limits = 7, 8 limits.value_limits = 9.0, 10.0 plot_config.limits = limits self.assertEqual(plot_config.limits, limits) plot_config.setDistributionLineEnabled(True) plot_config.setLegendEnabled(False) plot_config.setGridEnabled(False) plot_config.setRefcaseEnabled(False) plot_config.setObservationsEnabled(False) style = PlotStyle("test_style", line_style=".", marker="g", width=2.5, size=7.5) plot_config.setDefaultStyle(style) plot_config.setRefcaseStyle(style) plot_config.setStatisticsStyle("mean", style) plot_config.setStatisticsStyle("min-max", style) plot_config.setStatisticsStyle("p50", style) plot_config.setStatisticsStyle("p10-p90", style) plot_config.setStatisticsStyle("p33-p67", style) plot_config.setStatisticsStyle("std", style) copy_of_plot_config = PlotConfig(ps, "Copy of Golden Sample") copy_of_plot_config.copyConfigFrom(plot_config) self.assertEqual(plot_config.isLegendEnabled(), copy_of_plot_config.isLegendEnabled()) self.assertEqual(plot_config.isGridEnabled(), copy_of_plot_config.isGridEnabled()) self.assertEqual(plot_config.isObservationsEnabled(), copy_of_plot_config.isObservationsEnabled()) self.assertEqual(plot_config.isDistributionLineEnabled(), copy_of_plot_config.isDistributionLineEnabled()) self.assertEqual(plot_config.refcaseStyle(), copy_of_plot_config.refcaseStyle()) self.assertEqual(plot_config.observationsStyle(), copy_of_plot_config.observationsStyle()) self.assertEqual(plot_config.histogramStyle(), copy_of_plot_config.histogramStyle()) self.assertEqual(plot_config.defaultStyle(), copy_of_plot_config.defaultStyle()) self.assertEqual(plot_config.currentColor(), copy_of_plot_config.currentColor()) self.assertEqual(plot_config.getStatisticsStyle("mean"), copy_of_plot_config.getStatisticsStyle("mean")) self.assertEqual(plot_config.getStatisticsStyle("min-max"), copy_of_plot_config.getStatisticsStyle("min-max")) self.assertEqual(plot_config.getStatisticsStyle("p50"), copy_of_plot_config.getStatisticsStyle("p50")) self.assertEqual(plot_config.getStatisticsStyle("p10-p90"), copy_of_plot_config.getStatisticsStyle("p10-p90")) self.assertEqual(plot_config.getStatisticsStyle("p33-p67"), copy_of_plot_config.getStatisticsStyle("p33-p67")) self.assertEqual(plot_config.getStatisticsStyle("std"), copy_of_plot_config.getStatisticsStyle("std")) self.assertEqual(plot_config.title(), copy_of_plot_config.title()) self.assertEqual(plot_config.limits, copy_of_plot_config.limits) plot_config.currentColor() # cycle state will not be copied plot_config.nextColor() copy_of_plot_config = PlotConfig(ps, "Another Copy of Golden Sample") copy_of_plot_config.copyConfigFrom(plot_config) self.assertEqual(plot_config.refcaseStyle(), copy_of_plot_config.refcaseStyle()) self.assertEqual(plot_config.observationsStyle(), copy_of_plot_config.observationsStyle()) self.assertNotEqual(plot_config.histogramStyle(), copy_of_plot_config.histogramStyle()) self.assertNotEqual(plot_config.defaultStyle(), copy_of_plot_config.defaultStyle()) self.assertNotEqual(plot_config.currentColor(), copy_of_plot_config.currentColor()) self.assertNotEqual(plot_config.getStatisticsStyle("mean"), copy_of_plot_config.getStatisticsStyle("mean")) self.assertNotEqual(plot_config.getStatisticsStyle("min-max"), copy_of_plot_config.getStatisticsStyle("min-max")) self.assertNotEqual(plot_config.getStatisticsStyle("p50"), copy_of_plot_config.getStatisticsStyle("p50")) self.assertNotEqual(plot_config.getStatisticsStyle("p10-p90"), copy_of_plot_config.getStatisticsStyle("p10-p90")) self.assertNotEqual(plot_config.getStatisticsStyle("p33-p67"), copy_of_plot_config.getStatisticsStyle("p33-p67")) self.assertNotEqual(plot_config.getStatisticsStyle("std"), copy_of_plot_config.getStatisticsStyle("std"))
def test_plot_config(self): ps = PlotSettings( ) plot_config = PlotConfig(ps , "Golden Sample", x_label="x", y_label="y") limits = PlotLimits() limits.count_limits = 1, 2 limits.depth_limits = 3, 4 limits.density_limits = 5, 6 limits.date_limits = datetime.date(2005, 2, 5), datetime.date(2006, 2, 6) limits.index_limits = 7, 8 limits.value_limits = 9.0, 10.0 plot_config.limits = limits self.assertEqual(plot_config.limits, limits) plot_config.setDistributionLineEnabled(True) plot_config.setLegendEnabled(False) plot_config.setGridEnabled(False) plot_config.setRefcaseEnabled(False) plot_config.setObservationsEnabled(False) style = PlotStyle("test_style", line_style=".", marker="g", width=2.5, size=7.5) plot_config.setDefaultStyle(style) plot_config.setRefcaseStyle(style) plot_config.setStatisticsStyle("mean", style) plot_config.setStatisticsStyle("min-max", style) plot_config.setStatisticsStyle("p50", style) plot_config.setStatisticsStyle("p10-p90", style) plot_config.setStatisticsStyle("p33-p67", style) plot_config.setStatisticsStyle("std", style) copy_of_plot_config = PlotConfig(ps , "Copy of Golden Sample") copy_of_plot_config.copyConfigFrom(plot_config) self.assertEqual(plot_config.isLegendEnabled(), copy_of_plot_config.isLegendEnabled()) self.assertEqual(plot_config.isGridEnabled(), copy_of_plot_config.isGridEnabled()) self.assertEqual(plot_config.isObservationsEnabled(), copy_of_plot_config.isObservationsEnabled()) self.assertEqual(plot_config.isDistributionLineEnabled(), copy_of_plot_config.isDistributionLineEnabled()) self.assertEqual(plot_config.refcaseStyle(), copy_of_plot_config.refcaseStyle()) self.assertEqual(plot_config.observationsStyle(), copy_of_plot_config.observationsStyle()) self.assertEqual(plot_config.histogramStyle(), copy_of_plot_config.histogramStyle()) self.assertEqual(plot_config.defaultStyle(), copy_of_plot_config.defaultStyle()) self.assertEqual(plot_config.currentColor(), copy_of_plot_config.currentColor()) self.assertEqual(plot_config.getStatisticsStyle("mean"), copy_of_plot_config.getStatisticsStyle("mean")) self.assertEqual(plot_config.getStatisticsStyle("min-max"), copy_of_plot_config.getStatisticsStyle("min-max")) self.assertEqual(plot_config.getStatisticsStyle("p50"), copy_of_plot_config.getStatisticsStyle("p50")) self.assertEqual(plot_config.getStatisticsStyle("p10-p90"), copy_of_plot_config.getStatisticsStyle("p10-p90")) self.assertEqual(plot_config.getStatisticsStyle("p33-p67"), copy_of_plot_config.getStatisticsStyle("p33-p67")) self.assertEqual(plot_config.getStatisticsStyle("std"), copy_of_plot_config.getStatisticsStyle("std")) self.assertEqual(plot_config.title(), copy_of_plot_config.title()) self.assertEqual(plot_config.limits, copy_of_plot_config.limits) plot_config.currentColor() # cycle state will not be copied plot_config.nextColor() copy_of_plot_config = PlotConfig(ps, "Another Copy of Golden Sample") copy_of_plot_config.copyConfigFrom(plot_config) self.assertEqual(plot_config.refcaseStyle(), copy_of_plot_config.refcaseStyle()) self.assertEqual(plot_config.observationsStyle(), copy_of_plot_config.observationsStyle()) self.assertNotEqual(plot_config.histogramStyle(), copy_of_plot_config.histogramStyle()) self.assertNotEqual(plot_config.defaultStyle(), copy_of_plot_config.defaultStyle()) self.assertNotEqual(plot_config.currentColor(), copy_of_plot_config.currentColor()) self.assertNotEqual(plot_config.getStatisticsStyle("mean"), copy_of_plot_config.getStatisticsStyle("mean")) self.assertNotEqual(plot_config.getStatisticsStyle("min-max"), copy_of_plot_config.getStatisticsStyle("min-max")) self.assertNotEqual(plot_config.getStatisticsStyle("p50"), copy_of_plot_config.getStatisticsStyle("p50")) self.assertNotEqual(plot_config.getStatisticsStyle("p10-p90"), copy_of_plot_config.getStatisticsStyle("p10-p90")) self.assertNotEqual(plot_config.getStatisticsStyle("p33-p67"), copy_of_plot_config.getStatisticsStyle("p33-p67")) self.assertNotEqual(plot_config.getStatisticsStyle("std"), copy_of_plot_config.getStatisticsStyle("std"))