def test_std_metric_instance(self): metric = metrics.Metric('test') out = metrics.std(metric) self.assertTrue(isinstance(out, metrics.MetricTree)) self.assertTrue(isinstance(out.children[0], metrics.ToDict)) self.assertTrue(isinstance(out.children[0].metric, metrics.Std)) self.assertTrue(out.children[0].metric.name == 'test_std') self.assertTrue(out.root.name == 'test')
def test_std_metric(self): metric = metrics.Metric out = metrics.std(metric)('test').build() self.assertTrue(isinstance(out, metrics.MetricTree)) self.assertTrue(isinstance(out.children[0], metrics.ToDict)) self.assertTrue(isinstance(out.children[0].metric, metrics.Std)) self.assertTrue(out.children[0].metric.name == 'test_std') self.assertTrue(out.root.name == 'test')
def test_std_metric_factory(self, build_mock): metric = metrics.MetricFactory build_mock.return_value=metrics.Metric('test') out = metrics.std(metric)().build() self.assertTrue(isinstance(out, metrics.MetricTree)) self.assertTrue(isinstance(out.children[0], metrics.ToDict)) self.assertTrue(isinstance(out.children[0].metric, metrics.Std)) self.assertTrue(out.children[0].metric.name == 'test_std') self.assertTrue(out.root.name == 'test')
def test_std_metric_instance(self): metric = metrics.Metric('test') out = metrics.std(metric, dim=10, unbiased=False) self.assertTrue(isinstance(out, metrics.MetricTree)) self.assertTrue(isinstance(out.children[0], metrics.ToDict)) self.assertTrue(isinstance(out.children[0].metric, metrics.Std)) self.assertTrue(out.children[0].metric._kwargs['dim'] == 10) self.assertTrue(not out.children[0].metric._unbiased) self.assertTrue(out.children[0].metric.name == 'test_std') self.assertTrue(out.root.name == 'test')