コード例 #1
0
    def test_load(self, pickle_load_mock, open_mock):
        target = list(range(100))
        pickle_load_mock.return_value = target
        enter_mock = Mock()
        open_mock.return_value.__enter__.return_value = enter_mock

        filepath = '/path/to/dataset'
        data = lineflow.load(filepath)
        open_mock.assert_called_once_with(filepath, 'rb')
        pickle_load_mock.assert_called_once_with(enter_mock)

        self.assertListEqual(data.all(), target)
        self.assertEqual(data._dataset, target)
コード例 #2
0
ファイル: test_core.py プロジェクト: sobamchan/lineflow
    def test_load(self, pickle_load_mock, open_mock):
        pickle_load_mock.return_value = list(self.base)
        enter_mock = Mock()
        open_mock.return_value.__enter__.return_value = enter_mock

        filepath = '/path/to/dataset'
        data = lineflow.load(filepath)
        open_mock.assert_called_once_with(filepath, 'rb')
        pickle_load_mock.assert_called_once_with(enter_mock)

        self.assertListEqual(data.all(), list(self.base))
        self.assertEqual(data._dataset, list(self.base))

        with self.assertWarns(DeprecationWarning):
            lineflow.Dataset.load(filepath)