示例#1
0
    def test_binary_support(self):
        """
        Make sure keyword arguments are preserved through the OpenerTarget
        """
        # Verify we can't normally write binary data
        fp = OpenerTarget("mock://file.txt").open('w')
        self.assertRaises(TypeError, fp.write, b'\x07\x08\x07')

        # Verify the format is passed to the target and write binary data
        fp = OpenerTarget("mock://file.txt",
                          format=luigi.format.MixedUnicodeBytes).open('w')
        fp.write(b'\x07\x08\x07')
        fp.close()
示例#2
0
文件: opener_test.py 项目: 01-/luigi
    def test_binary_support(self):
        '''Make sure keyword arguments are preserved through the OpenerTarget

        '''
        if six.PY3:
            # Verify we can't normally write binary data
            fp = OpenerTarget("mock://file.txt").open('w')
            self.assertRaises(TypeError, fp.write, b'\x07\x08\x07')

            # Verify the format is passed to the target and write binary data
            fp = OpenerTarget("mock://file.txt",
                              format=luigi.format.MixedUnicodeBytes).open('w')
            fp.write(b'\x07\x08\x07')
            fp.close()