예제 #1
0
파일: repo.py 프로젝트: ActivKonnect/castor
    def test_ensure_when_content_without_line_feed(self):
        with NamedTemporaryFile('w') as f:
            f.write('hi')
            f.flush()

            ensure_line_in_file(f.name, 'hello')

            with open(f.name, 'r') as r:
                self.assertEqual('hi\nhello\n', r.read())
예제 #2
0
파일: repo.py 프로젝트: VincentLoy/castor
    def test_ensure_when_content_without_line_feed(self):
        with NamedTemporaryFile("w") as f:
            f.write("hi")
            f.flush()

            ensure_line_in_file(f.name, "hello")

            with open(f.name, "r") as r:
                self.assertEqual("hi\nhello\n", r.read())
예제 #3
0
파일: repo.py 프로젝트: ActivKonnect/castor
 def test_ensure_when_empty(self):
     with NamedTemporaryFile('r') as f:
         ensure_line_in_file(f.name, 'hello')
         self.assertEqual(f.read(), 'hello\n')
예제 #4
0
파일: repo.py 프로젝트: ActivKonnect/castor
 def test_ensure_auto_line_feed(self):
     with NamedTemporaryFile('r') as f:
         ensure_line_in_file(f.name, 'hello\n')
         self.assertEqual('hello\n', f.read())
예제 #5
0
파일: repo.py 프로젝트: VincentLoy/castor
 def test_ensure_when_empty(self):
     with NamedTemporaryFile("r") as f:
         ensure_line_in_file(f.name, "hello")
         self.assertEqual(f.read(), "hello\n")
예제 #6
0
파일: repo.py 프로젝트: VincentLoy/castor
 def test_ensure_auto_line_feed(self):
     with NamedTemporaryFile("r") as f:
         ensure_line_in_file(f.name, "hello\n")
         self.assertEqual("hello\n", f.read())