示例#1
0
文件: mock_test.py 项目: NeverC/luigi
    def test_with(self):
        t = MockFile("foo")
        with t.open('w') as b:
            b.write("bar")

        with t.open('r') as b:
            self.assertEquals(list(b), ['bar'])
示例#2
0
文件: mock_test.py 项目: NeverC/luigi
    def test_1(self):
        t = MockFile('test')
        p = t.open('w')
        print >> p, 'test'
        p.close()

        q = t.open('r')
        self.assertEqual(list(q), ['test\n'])
        q.close()
示例#3
0
文件: mock_test.py 项目: g152xx/luigi
    def test_1(self):
        t = MockFile("test")
        p = t.open("w")
        print >> p, "test"
        p.close()

        q = t.open("r")
        self.assertEqual(list(q), ["test\n"])
        q.close()
示例#4
0
文件: mock_test.py 项目: NeverC/luigi
 def _touch(self, path):
     t = MockFile(path)
     with t.open('w'):
         pass