<s> """<STR_LIT>""" <EOL> import os <EOL> import unittest <EOL> from dfvfs . path import sqlite_blob_path_spec <EOL> from dfvfs . path import os_path_spec <EOL> from dfvfs . resolver import context <EOL> from dfvfs . vfs import sqlite_blob_file_entry <EOL> from dfvfs . vfs import sqlite_blob_file_system <EOL> class SQLiteBlobFileEntryTest ( unittest . TestCase ) : <EOL> """<STR_LIT>""" <EOL> def setUp ( self ) : <EOL> """<STR_LIT>""" <EOL> self . _resolver_context = context . Context ( ) <EOL> test_file = os . path . join ( u'<STR_LIT>' , u'<STR_LIT>' ) <EOL> path_spec = os_path_spec . OSPathSpec ( location = test_file ) <EOL> self . _sqlite_blob_path_spec = sqlite_blob_path_spec . SQLiteBlobPathSpec ( <EOL> table_name = u'<STR_LIT>' , column_name = u'<STR_LIT>' , <EOL> row_condition = ( u'<STR_LIT:name>' , u'<STR_LIT>' , u'<STR_LIT>' ) , parent = path_spec ) <EOL> self . _sqlite_blob_path_spec_2 = sqlite_blob_path_spec . SQLiteBlobPathSpec ( <EOL> table_name = u'<STR_LIT>' , column_name = u'<STR_LIT>' , <EOL> row_index = <NUM_LIT:2> , parent = path_spec ) <EOL> self . _sqlite_blob_path_spec_directory = ( <EOL> sqlite_blob_path_spec . SQLiteBlobPathSpec ( <EOL> table_name = u'<STR_LIT>' , column_name = u'<STR_LIT>' , parent = path_spec ) ) <EOL> self . _file_system = sqlite_blob_file_system . SQLiteBlobFileSystem ( <EOL> self . _resolver_context ) <EOL> self . _file_system . Open ( self . _sqlite_blob_path_spec ) <EOL> def tearDown ( self ) : <EOL> """<STR_LIT>""" <EOL> self . _file_system . Close ( ) <EOL> def testIntialize ( self ) : <EOL> """<STR_LIT>""" <EOL> file_entry = sqlite_blob_file_entry . SQLiteBlobFileEntry ( <EOL> self . _resolver_context , self . _file_system , self . _sqlite_blob_path_spec ) <EOL> self . assertIsNotNone ( file_entry ) <EOL> file_entry = sqlite_blob_file_entry . SQLiteBlobFileEntry ( <EOL> self . _resolver_context , self . _file_system , <EOL> self . _sqlite_blob_path_spec_2 ) <EOL> self . assertIsNotNone ( file_entry ) <EOL> def testGetFileEntryByPathSpec ( self ) : <EOL> """<STR_LIT>""" <EOL> file_entry = self . _file_system . GetFileEntryByPathSpec ( <EOL> self . _sqlite_blob_path_spec ) <EOL> self . assertIsNotNone ( file_entry ) <EOL> file_entry = self . _file_system . GetFileEntryByPathSpec ( <EOL> self . _sqlite_blob_path_spec_2 ) <EOL> self . assertIsNotNone ( file_entry ) <EOL> def testGetParentFileEntry ( self ) : <EOL> """<STR_LIT>""" <EOL> file_entry = self . _file_system . GetFileEntryByPathSpec ( <EOL> self . _sqlite_blob_path_spec ) <EOL> self . assertIsNotNone ( file_entry ) <EOL> parent_file_entry = file_entry . GetParentFileEntry ( ) <EOL> self . assertIsNotNone ( parent_file_entry ) <EOL> self . assertEqual ( parent_file_entry . name , u'<STR_LIT>' ) <EOL> def testGetStat ( self ) : <EOL> """<STR_LIT>""" <EOL> file_entry = self . _file_system . GetFileEntryByPathSpec ( <EOL> self . _sqlite_blob_path_spec ) <EOL> stat_object = file_entry . GetStat ( ) <EOL> self . assertIsNotNone ( stat_object ) <EOL> self . assertEqual ( stat_object . type , stat_object . TYPE_FILE ) <EOL> self . assertEqual ( stat_object . size , <NUM_LIT> ) <EOL> file_entry = self . _file_system . GetFileEntryByPathSpec ( <EOL> self . _sqlite_blob_path_spec_2 ) <EOL> stat_object = file_entry . GetStat ( ) <EOL> self . assertIsNotNone ( stat_object ) <EOL> self . assertEqual ( stat_object . type , stat_object . TYPE_FILE ) <EOL> self . assertEqual ( stat_object . size , <NUM_LIT:11> ) <EOL> def testIsFunctions ( self ) : <EOL> """<STR_LIT>""" <EOL> file_entry = self . _file_system . GetFileEntryByPathSpec ( <EOL> self . _sqlite_blob_path_spec ) <EOL> self . assertFalse ( file_entry . IsRoot ( ) ) <EOL> self . assertFalse ( file_entry . IsVirtual ( ) ) <EOL> self . assertTrue ( file_entry . IsAllocated ( ) ) <EOL> self . assertFalse ( file_entry . IsDevice ( ) ) <EOL> self . assertFalse ( file_entry . IsDirectory ( ) ) <EOL> self . assertTrue ( file_entry . IsFile ( ) ) <EOL> self . assertFalse ( file_entry . IsLink ( ) ) <EOL> self . assertFalse ( file_entry . IsPipe ( ) ) <EOL> self . assertFalse ( file_entry . IsSocket ( ) ) <EOL> def testSubFileEntries ( self ) : <EOL> """<STR_LIT>""" <EOL> file_entry = self . _file_system . GetFileEntryByPathSpec ( <EOL> self . _sqlite_blob_path_spec_directory ) <EOL> self . assertTrue ( file_entry . IsDirectory ( ) ) <EOL> self . assertIsNotNone ( file_entry ) <EOL> self . assertEqual ( file_entry . number_of_sub_file_entries , <NUM_LIT:4> ) <EOL> expected_sub_file_entry_names = [ <EOL> u'<STR_LIT>' , u'<STR_LIT>' , u'<STR_LIT>' , u'<STR_LIT>' ] <EOL> sub_file_entry_names = [ ] <EOL> for sub_file_entry in file_entry . sub_file_entries : <EOL> sub_file_entry_names . append ( sub_file_entry . name ) <EOL> self . assertEqual ( <EOL> len ( sub_file_entry_names ) , len ( expected_sub_file_entry_names ) ) <EOL> self . assertEqual ( <EOL> sorted ( sub_file_entry_names ) , expected_sub_file_entry_names ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> unittest . main ( ) </s>
