当前位置: 首页>>代码示例>>Python>>正文


Python contenttype.get_filetype函数代码示例

本文整理汇总了Python中typecode.contenttype.get_filetype函数的典型用法代码示例。如果您正苦于以下问题:Python get_filetype函数的具体用法?Python get_filetype怎么用?Python get_filetype使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了get_filetype函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_doc_xml

    def test_doc_xml(self):
        assert not is_binary(self.get_test_loc('contenttype/doc/xml/simple.xml'))
        assert 'xml language text' == get_filetype(self.get_test_loc('contenttype/doc/xml/simple.xml'))

        assert not is_binary(self.get_test_loc('contenttype/doc/xml/some.xml'))
        assert 'xml language text' == get_filetype(self.get_test_loc('contenttype/doc/xml/some.xml'))

        assert not is_binary(self.get_test_loc('contenttype/doc/xml/somespring.xml'))
        assert 'xml language text' == get_filetype(self.get_test_loc('contenttype/doc/xml/somespring.xml'))
开发者ID:pombredanne,项目名称:scancode-toolkit,代码行数:9,代码来源:test_contenttype.py

示例2: test_doc_office_word

    def test_doc_office_word(self):
        assert 'microsoft word 2007+' == get_filetype(self.get_test_loc('contenttype/doc/office/document'))

        assert 'microsoft word 2007+' == get_filetype(self.get_test_loc('contenttype/doc/office/document.doc'))

        assert not is_special(self.get_test_loc('contenttype/doc/office/word.doc'))
        assert '' == get_filetype_pygment(self.get_test_loc('contenttype/doc/office/word.doc'))
        assert 'application/msword' == get_mimetype_file(self.get_test_loc('contenttype/doc/office/word.doc'))
        assert get_filetype(self.get_test_loc('contenttype/doc/office/word.doc')).startswith('composite document file v2 document')
        assert get_filetype_file(self.get_test_loc('contenttype/doc/office/word.doc')).startswith('Composite Document File V2 Document')

        assert 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' == get_mimetype_file(self.get_test_loc('contenttype/doc/office/word.docx'))
开发者ID:pombredanne,项目名称:scancode-toolkit,代码行数:12,代码来源:test_contenttype.py

示例3: test_binary_random_data

 def test_binary_random_data(self):
     assert 'data' == get_filetype(self.get_test_loc('contenttype/binary-random/binary_random_0'))
     assert 'data' == get_filetype(self.get_test_loc('contenttype/binary-random/binary_random_1'))
     assert 'data' == get_filetype(self.get_test_loc('contenttype/binary-random/binary_random_2'))
     assert 'data' == get_filetype(self.get_test_loc('contenttype/binary-random/binary_random_3'))
     assert 'data' == get_filetype(self.get_test_loc('contenttype/binary-random/binary_random_4'))
     assert 'data' == get_filetype(self.get_test_loc('contenttype/binary-random/binary_random_5'))
     assert 'data' == get_filetype(self.get_test_loc('contenttype/binary-random/binary_random_6'))
     assert 'data' == get_filetype(self.get_test_loc('contenttype/binary-random/binary_random_7'))
     assert 'data' == get_filetype(self.get_test_loc('contenttype/binary-random/binary_random_8'))
开发者ID:pombredanne,项目名称:scancode-toolkit,代码行数:10,代码来源:test_contenttype.py

示例4: test_code_python_2

 def test_code_python_2(self):
     assert is_source(self.get_test_loc('contenttype/code/python/extract.py'))
     assert is_text(self.get_test_loc('contenttype/code/python/extract.py'))
     assert 'Python' == get_filetype_pygment(self.get_test_loc('contenttype/code/python/extract.py'))
     assert 'python language text' == get_filetype(self.get_test_loc('contenttype/code/python/extract.py'))
     assert 'text/x-python' == get_mimetype_file(self.get_test_loc('contenttype/code/python/extract.py'))
     assert get_filetype_file(self.get_test_loc('contenttype/code/python/extract.py')).startswith('Python script')
开发者ID:pombredanne,项目名称:scancode-toolkit,代码行数:7,代码来源:test_contenttype.py

示例5: test_code_java_non_ascii

 def test_code_java_non_ascii(self):
     assert is_source(self.get_test_loc('contenttype/code/java/ChartTiming1.java'))
     assert is_text(self.get_test_loc('contenttype/code/java/ChartTiming1.java'))
     # FIXME: incorrect
     assert 'application/octet-stream' == get_mimetype_file(self.get_test_loc('contenttype/code/java/ChartTiming1.java'))
     assert 'Java' == get_filetype_pygment(self.get_test_loc('contenttype/code/java/ChartTiming1.java'))
     assert 'java language text' == get_filetype(self.get_test_loc('contenttype/code/java/ChartTiming1.java'))
开发者ID:pombredanne,项目名称:scancode-toolkit,代码行数:7,代码来源:test_contenttype.py

示例6: test_code_c_6

 def test_code_c_6(self):
     assert is_source(self.get_test_loc('contenttype/code/c/pci_v3.c'))
     assert is_text(self.get_test_loc('contenttype/code/c/pci_v3.c'))
     assert 'C source, ASCII text' == get_filetype_file(self.get_test_loc('contenttype/code/c/pci_v3.c'))
     assert 'C' == get_filetype_pygment(self.get_test_loc('contenttype/code/c/pci_v3.c'))
     assert 'c language text' == get_filetype(self.get_test_loc('contenttype/code/c/pci_v3.c'))
     assert 'text/x-c' == get_mimetype_file(self.get_test_loc('contenttype/code/c/pci_v3.c'))
开发者ID:pombredanne,项目名称:scancode-toolkit,代码行数:7,代码来源:test_contenttype.py

示例7: test_build_makefile

 def test_build_makefile(self):
     assert is_source(self.get_test_loc('contenttype/build/Makefile'))
     assert is_text(self.get_test_loc('contenttype/build/Makefile'))
     assert 'Makefile' == get_filetype_pygment(self.get_test_loc('contenttype/build/Makefile'))
     assert 'ASCII text' == get_filetype_file(self.get_test_loc('contenttype/build/Makefile'))
     assert 'makefile language text' == get_filetype(self.get_test_loc('contenttype/build/Makefile'))
     assert 'text/plain' == get_mimetype_file(self.get_test_loc('contenttype/build/Makefile'))
开发者ID:pombredanne,项目名称:scancode-toolkit,代码行数:7,代码来源:test_contenttype.py

示例8: test_compiled_python_4

 def test_compiled_python_4(self):
     test_dir = self.extract_test_zip('contenttype/compiled/python/compiled.zip')
     assert 'python 2.5 byte-compiled' == get_filetype(os.path.join(test_dir, 'extract.pyc'))
     assert not is_source(os.path.join(test_dir, 'extract.pyc'))
     assert not is_text(os.path.join(test_dir, 'extract.pyc'))
     assert 'application/octet-stream' == get_mimetype_file(os.path.join(test_dir, 'extract.pyc'))
     assert '' == get_filetype_pygment(os.path.join(test_dir, 'extract.pyc'))
开发者ID:pombredanne,项目名称:scancode-toolkit,代码行数:7,代码来源:test_contenttype.py

示例9: test_text_log

 def test_text_log(self):
     assert not is_source(self.get_test_loc('contenttype/text/windowserver.log'))
     assert is_text(self.get_test_loc('contenttype/text/windowserver.log'))
     assert '' == get_filetype_pygment(self.get_test_loc('contenttype/text/windowserver.log'))
     assert 'ascii text' == get_filetype(self.get_test_loc('contenttype/text/windowserver.log'))
     assert 'ASCII text' == get_filetype_file(self.get_test_loc('contenttype/text/windowserver.log'))
     assert 'text/plain' == get_mimetype_file(self.get_test_loc('contenttype/text/windowserver.log'))
开发者ID:pombredanne,项目名称:scancode-toolkit,代码行数:7,代码来源:test_contenttype.py

示例10: test_doc_html_3

 def test_doc_html_3(self):
     assert is_source(self.get_test_loc('contenttype/doc/html/Label.html'))
     assert is_text(self.get_test_loc('contenttype/doc/html/Label.html'))
     assert 'HTML' == get_filetype_pygment(self.get_test_loc('contenttype/doc/html/Label.html'))
     assert 'html language text' == get_filetype(self.get_test_loc('contenttype/doc/html/Label.html'))
     assert 'text/html' == get_mimetype_file(self.get_test_loc('contenttype/doc/html/Label.html'))
     assert 'HTML document, ASCII text, with very long lines' == get_filetype_file(self.get_test_loc('contenttype/doc/html/Label.html'))
开发者ID:pombredanne,项目名称:scancode-toolkit,代码行数:7,代码来源:test_contenttype.py

示例11: test_doc_html_2

 def test_doc_html_2(self):
     assert is_source(self.get_test_loc('contenttype/doc/html/allclasses-frame.html'))
     assert is_text(self.get_test_loc('contenttype/doc/html/allclasses-frame.html'))
     assert 'HTML' == get_filetype_pygment(self.get_test_loc('contenttype/doc/html/allclasses-frame.html'))
     assert 'html language text' == get_filetype(self.get_test_loc('contenttype/doc/html/allclasses-frame.html'))
     assert 'text/html' == get_mimetype_file(self.get_test_loc('contenttype/doc/html/allclasses-frame.html'))
     assert 'HTML document, ASCII text' == get_filetype_file(self.get_test_loc('contenttype/doc/html/allclasses-frame.html'))
开发者ID:pombredanne,项目名称:scancode-toolkit,代码行数:7,代码来源:test_contenttype.py

示例12: test_code_groff

 def test_code_groff(self):
     assert not is_special(self.get_test_loc(u'contenttype/code/groff/example.ms'))
     assert is_text(self.get_test_loc(u'contenttype/code/groff/example.ms'))
     assert 'Groff' == get_filetype_pygment(self.get_test_loc(u'contenttype/code/groff/example.ms'))
     assert 'groff language text' == get_filetype(self.get_test_loc(u'contenttype/code/groff/example.ms'))
     assert 'text/troff' == get_mimetype_python(self.get_test_loc(u'contenttype/code/groff/example.ms'))
     assert 'text/troff' == get_mimetype_file(self.get_test_loc(u'contenttype/code/groff/example.ms'))
     assert get_filetype_file(self.get_test_loc(u'contenttype/code/groff/example.ms')).startswith('troff or preprocessor input')
开发者ID:pombredanne,项目名称:scancode-toolkit,代码行数:8,代码来源:test_contenttype.py

示例13: test_contenttype_fifo

 def test_contenttype_fifo(self):
     test_dir = self.get_temp_dir()
     myfifo = os.path.join(test_dir, 'myfifo')
     import subprocess
     if subprocess.call(['mkfifo', myfifo]) != 0:
         self.fail('Unable to create fifo')
     assert os.path.exists(myfifo)
     assert is_special(myfifo)
     assert 'FIFO pipe' == get_filetype(myfifo)
开发者ID:pombredanne,项目名称:scancode-toolkit,代码行数:9,代码来源:test_contenttype.py

示例14: test_text_license_credits

 def test_text_license_credits(self):
     # FIXME
     assert 'css+lasso language text' == get_filetype(self.get_test_loc('contenttype/text/CREDITS'))
     assert is_text(self.get_test_loc('contenttype/text/CREDITS'))
     # FIXME: incorrect
     assert is_source(self.get_test_loc('contenttype/text/CREDITS'))
     # FIXME: incorrect
     assert 'CSS+Lasso' == get_filetype_pygment(self.get_test_loc('contenttype/text/CREDITS'))
     assert 'ISO-8859 text' == get_filetype_file(self.get_test_loc('contenttype/text/CREDITS'))
     assert 'text/plain' == get_mimetype_file(self.get_test_loc('contenttype/text/CREDITS'))
开发者ID:pombredanne,项目名称:scancode-toolkit,代码行数:10,代码来源:test_contenttype.py

示例15: test_code_groff

 def test_code_groff(self):
     assert not is_special(self.get_test_loc(u'contenttype/code/groff/example.ms'))
     assert is_text(self.get_test_loc(u'contenttype/code/groff/example.ms'))
     assert 'Groff' == get_filetype_pygment(self.get_test_loc(u'contenttype/code/groff/example.ms'))
     assert 'groff language text' == get_filetype(self.get_test_loc(u'contenttype/code/groff/example.ms'))
     # the Apache mimes do not have .ms in their types
     # but the type is still mysteriously returnedd on Windows
     assert '' == get_mimetype_python(self.get_test_loc(u'contenttype/code/groff/example.ms'))
     assert 'text/troff' == get_mimetype_file(self.get_test_loc(u'contenttype/code/groff/example.ms'))
     assert get_filetype_file(self.get_test_loc(u'contenttype/code/groff/example.ms')).startswith('troff or preprocessor input')
开发者ID:10imaging,项目名称:scancode-toolkit,代码行数:10,代码来源:test_contenttype.py


注:本文中的typecode.contenttype.get_filetype函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。