Example #1
0
    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))
Example #2
0
    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))
Example #3
0
    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))
Example #4
0
    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))
Example #5
0
    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'))
Example #6
0
    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'))
Example #7
0
 def test_is_text_should_consider_symlinks_as_non_text(self):
     self.assertFalse(trim.is_text(os.path.join(ROOT_DIR, 'trim.py')))
Example #8
0
 def test_is_text_should_consider_symlinks_as_non_text(self):
     self.assertFalse(trim.is_text(os.path.join(ROOT_DIR, 'trim.py')))