tests.py 文件源码

python
阅读 31 收藏 0 点赞 0 评论 0

项目:LIMS-Backend 作者: LeafLIMS 项目源码 文件源码
def test_fetch(self):
        # Create temp file to copy
        file = open(os.path.join(self._copyFile.copy_from_prefix,
                                 "%sbigFileXYZA" % tempfile.gettempprefix()), 'w')
        file.write("Lots of interesting stuff")
        file.close()
        # Perform copy
        interpolate_dict = {"project_identifier": tempfile.gettempprefix(),
                            "product_identifier": "bigFile",
                            "run_identifier": "XYZ"}
        result_paths = self._copyFile.fetch(interpolate_dict=interpolate_dict)
        # Test copied file exists and DataFile matches
        self.assertEqual(len(result_paths), 1)
        df = result_paths[0]
        self.assertEqual(df.file_name, "%sbigFileXYZB" % tempfile.gettempprefix())
        self.assertEqual(df.location, os.path.join(tempfile.gettempdir(),
                                                   "%sbigFileXYZB" % tempfile.gettempprefix()))
        self.assertEqual(df.equipment, self._equipmentSequencer)
        self.assertIs(filecmp.cmp(
            os.path.join(tempfile.gettempdir(), "%sbigFileXYZA" % tempfile.gettempprefix()),
            os.path.join(tempfile.gettempdir(), "%sbigFileXYZB" % tempfile.gettempprefix())), True)
        # Clean up
        os.remove(os.path.join(tempfile.gettempdir(), "%sbigFileXYZA" % tempfile.gettempprefix()))
        os.remove(os.path.join(tempfile.gettempdir(), "%sbigFileXYZB" % tempfile.gettempprefix()))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号