当前位置: 首页>>代码示例>>Python>>正文


Python WorkflowManager._make_histogram方法代码示例

本文整理汇总了Python中vis.workflow.WorkflowManager._make_histogram方法的典型用法代码示例。如果您正苦于以下问题:Python WorkflowManager._make_histogram方法的具体用法?Python WorkflowManager._make_histogram怎么用?Python WorkflowManager._make_histogram使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在vis.workflow.WorkflowManager的用法示例。


在下文中一共展示了WorkflowManager._make_histogram方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_histogram_4

# 需要导入模块: from vis.workflow import WorkflowManager [as 别名]
# 或者: from vis.workflow.WorkflowManager import _make_histogram [as 别名]
 def test_histogram_4(self, mock_call, mock_gdf, mock_join):
     # test_output_4() but the subprocess thing fails
     def raiser(*args):
         raise CalledProcessError(u'Bach!', 42, u'CPE')
     mock_call.side_effect = raiser
     test_wc = WorkflowManager([])
     test_wc._previous_exp = u'intervals'
     test_wc._data = [1 for _ in xrange(20)]
     test_wc._result = MagicMock(spec=pandas.DataFrame)
     path = u'pathname!'
     expected_msg = u'Error during call to R: CPE (return code: Bach!)'
     actual = None
     try:
         test_wc._make_histogram(path)
     except RuntimeError as run_e:
         actual = run_e
     self.assertEqual(expected_msg, actual.message)
     self.assertEqual(0, mock_gdf.call_count)
     expected_args = [u'Rscript', u'--vanilla', mock_join.return_value,
                      path + u'.dta', path + u'.png', u'int', u'20']
     mock_call.assert_called_once_with(expected_args)
     self.assertEqual(1, mock_join.call_count)
开发者ID:ELVIS-Project,项目名称:fiddle-tunes,代码行数:24,代码来源:test_workflow.py

示例2: test_histogram_1

# 需要导入模块: from vis.workflow import WorkflowManager [as 别名]
# 或者: from vis.workflow.WorkflowManager import _make_histogram [as 别名]
 def test_histogram_1(self, mock_call, mock_gdf, mock_join):
     # with specified pathname; last experiment was intervals with 20 pieces; self._result is DF
     test_wc = WorkflowManager([])
     test_wc._previous_exp = u'intervals'
     test_wc._data = [1 for _ in xrange(20)]
     test_wc._result = MagicMock(spec=pandas.DataFrame)
     path = u'pathname!'
     actual = test_wc._make_histogram(path)
     self.assertEqual(0, mock_gdf.call_count)
     expected_args = [u'Rscript', u'--vanilla', mock_join.return_value,
                      path + u'.dta', path + u'.png', u'int', u'20']
     mock_call.assert_called_once_with(expected_args)
     self.assertEqual(path + u'.png', actual)
     self.assertEqual(1, mock_join.call_count)
开发者ID:ELVIS-Project,项目名称:fiddle-tunes,代码行数:16,代码来源:test_workflow.py

示例3: test_histogram_3

# 需要导入模块: from vis.workflow import WorkflowManager [as 别名]
# 或者: from vis.workflow.WorkflowManager import _make_histogram [as 别名]
 def test_histogram_3(self, mock_call, mock_gdf, mock_join):
     # test_ouput_6, plus top_x and threshold
     test_wc = WorkflowManager([])
     test_wc._previous_exp = u'n-grams'
     test_wc._data = [1]
     test_wc._shared_settings[u'n'] = 14
     test_wc._result = MagicMock(spec=pandas.Series)
     path = u'test_output/output_result'
     actual = test_wc._make_histogram(top_x=420, threshold=1987)
     mock_gdf.assert_called_once_with(u'freq', 420, 1987)
     expected_args = [u'Rscript', u'--vanilla', mock_join.return_value,
                      path + u'.dta', path + u'.png', u'14', u'1']
     mock_call.assert_called_once_with(expected_args)
     self.assertEqual(path + u'.png', actual)
     self.assertEqual(1, mock_join.call_count)
开发者ID:ELVIS-Project,项目名称:fiddle-tunes,代码行数:17,代码来源:test_workflow.py

示例4: test_histogram_2

# 需要导入模块: from vis.workflow import WorkflowManager [as 别名]
# 或者: from vis.workflow.WorkflowManager import _make_histogram [as 别名]
 def test_histogram_2(self, mock_call, mock_gdf, mock_join):
     # with unspecified pathname; last experiment was 14-grams with 1 piece; self._result is S
     test_wc = WorkflowManager([])
     test_wc._previous_exp = u'n-grams'
     test_wc._data = [1]
     test_wc._shared_settings[u'n'] = 14
     test_wc._result = MagicMock(spec=pandas.Series)
     path = u'test_output/output_result'
     actual = test_wc._make_histogram()
     mock_gdf.assert_called_once_with(u'freq', None, None)
     expected_args = [u'Rscript', u'--vanilla', mock_join.return_value,
                      path + u'.dta', path + u'.png', u'14', u'1']
     mock_call.assert_called_once_with(expected_args)
     self.assertEqual(path + u'.png', actual)
     self.assertEqual(1, mock_join.call_count)
开发者ID:ELVIS-Project,项目名称:fiddle-tunes,代码行数:17,代码来源:test_workflow.py

示例5: test_histogram_3

# 需要导入模块: from vis.workflow import WorkflowManager [as 别名]
# 或者: from vis.workflow.WorkflowManager import _make_histogram [as 别名]
    def test_histogram_3(self, mock_bar, mock_fdf):
        """
        That _make_histogram() works properly.
        - pathname: None
        - top_x: None
        - threshold: None
        - test_wc._previous_exp: 'cheese'
        """
        test_wc = WorkflowManager([])
        test_wc._previous_exp = 'cheese'
        mock_fdf.return_value = 'filtered DataFrame'
        exp_setts = {'pathname': 'test_output/output_result', 'token': 'objects', 'type': 'png',
                     'nr_pieces': 0}
        exp_png_path = 'your png path'
        mock_experimenter = mock.MagicMock()
        mock_experimenter.run = mock.MagicMock(return_value=exp_png_path)
        mock_bar.RBarChart = mock.MagicMock(return_value=mock_experimenter)

        actual = test_wc._make_histogram()

        self.assertEqual(exp_png_path, actual)
        mock_fdf.assert_called_once_with(top_x=None, threshold=None, name='freq')
        mock_bar.RBarChart.assert_called_once_with(mock_fdf.return_value, exp_setts)
开发者ID:ELVIS-Project,项目名称:vis-framework,代码行数:25,代码来源:test_workflow.py

示例6: test_histogram_2

# 需要导入模块: from vis.workflow import WorkflowManager [as 别名]
# 或者: from vis.workflow.WorkflowManager import _make_histogram [as 别名]
    def test_histogram_2(self, mock_bar, mock_fdf):
        """
        That _make_histogram() works properly.
        - pathname: given
        - top_x: given
        - threshold: given
        - test_wc._previous_exp: 'interval n-grams'
        """
        test_wc = WorkflowManager([])
        test_wc._previous_exp = 'interval n-grams'
        test_wc.settings(None, 'n', 42)
        mock_fdf.return_value = 'filtered DataFrame'
        exp_setts = {'pathname': 'some_path', 'token': '42-gram', 'type': 'png',
                     'nr_pieces': 0}
        exp_png_path = 'your png path'
        mock_experimenter = mock.MagicMock()
        mock_experimenter.run = mock.MagicMock(return_value=exp_png_path)
        mock_bar.RBarChart = mock.MagicMock(return_value=mock_experimenter)

        actual = test_wc._make_histogram('some_path', 10, 100)

        self.assertEqual(exp_png_path, actual)
        mock_fdf.assert_called_once_with(top_x=10, threshold=100, name='freq')
        mock_bar.RBarChart.assert_called_once_with(mock_fdf.return_value, exp_setts)
开发者ID:ELVIS-Project,项目名称:vis-framework,代码行数:26,代码来源:test_workflow.py


注:本文中的vis.workflow.WorkflowManager._make_histogram方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。