示例#1
0
文件: test_trim.py 项目: myint/trim
    def test_is_text_should_consider_empty_files_as_non_text(self):
        import tempfile
        with tempfile.NamedTemporaryFile(mode='w') as temporary_file:
            temporary_file.write('')
            temporary_file.flush()

            self.assertFalse(trim.is_text(temporary_file.name))
示例#2
0
文件: test_trim.py 项目: myint/trim
    def test_is_text_should_consider_empty_files_as_non_text(self):
        import tempfile
        with tempfile.NamedTemporaryFile(mode='w') as temporary_file:
            temporary_file.write('')
            temporary_file.flush()

            self.assertFalse(trim.is_text(temporary_file.name))
示例#3
0
文件: test_trim.py 项目: myint/trim
    def test_is_text_should_consider_whitespace_only_as_text(self):
        import tempfile
        with tempfile.NamedTemporaryFile(mode='w') as temporary_file:
            temporary_file.write('     ')
            temporary_file.flush()

            self.assertTrue(trim.is_text(temporary_file.name))
示例#4
0
文件: test_trim.py 项目: myint/trim
    def test_is_text_should_consider_whitespace_only_as_text(self):
        import tempfile
        with tempfile.NamedTemporaryFile(mode='w') as temporary_file:
            temporary_file.write('     ')
            temporary_file.flush()

            self.assertTrue(trim.is_text(temporary_file.name))
示例#5
0
文件: test_trim.py 项目: myint/trim
    def test_is_text(self):
        self.assertTrue(trim.is_text(os.path.join(ROOT_DIR, 'README.rst')))
        self.assertTrue(trim.is_text(os.path.join(ROOT_DIR, 'trim')))

        self.assertFalse(trim.is_text(sys.executable))
        self.assertFalse(trim.is_text('/bin/bash'))
        self.assertFalse(trim.is_text('/usr/bin/env'))
        self.assertFalse(trim.is_text('non_existent_file'))
示例#6
0
文件: test_trim.py 项目: myint/trim
    def test_is_text(self):
        self.assertTrue(trim.is_text(os.path.join(ROOT_DIR, 'README.rst')))
        self.assertTrue(trim.is_text(os.path.join(ROOT_DIR, 'trim')))

        self.assertFalse(trim.is_text(sys.executable))
        self.assertFalse(trim.is_text('/bin/bash'))
        self.assertFalse(trim.is_text('/usr/bin/env'))
        self.assertFalse(trim.is_text('non_existent_file'))
示例#7
0
文件: test_trim.py 项目: myint/trim
 def test_is_text_should_consider_symlinks_as_non_text(self):
     self.assertFalse(trim.is_text(os.path.join(ROOT_DIR, 'trim.py')))
示例#8
0
文件: test_trim.py 项目: myint/trim
 def test_is_text_should_consider_symlinks_as_non_text(self):
     self.assertFalse(trim.is_text(os.path.join(ROOT_DIR, 'trim.py')))