<s> """<STR_LIT>""" <EOL> import os <EOL> import unittest <EOL> from dfvfs . helpers import windows_path_resolver <EOL> from dfvfs . path import os_path_spec <EOL> from dfvfs . path import qcow_path_spec <EOL> from dfvfs . path import tsk_path_spec <EOL> from dfvfs . resolver import context <EOL> from dfvfs . vfs import os_file_system <EOL> from dfvfs . vfs import tsk_file_system <EOL> class WindowsPathResolverTest ( unittest . TestCase ) : <EOL> """<STR_LIT>""" <EOL> def setUp ( self ) : <EOL> """<STR_LIT>""" <EOL> self . _resolver_context = context . Context ( ) <EOL> test_file = os . path . join ( os . getcwd ( ) , u'<STR_LIT>' ) <EOL> self . _os_path_spec = os_path_spec . OSPathSpec ( location = test_file ) <EOL> self . _os_file_system = os_file_system . OSFileSystem ( self . _resolver_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 . _qcow_path_spec = qcow_path_spec . QCOWPathSpec ( parent = path_spec ) <EOL> self . _tsk_path_spec = tsk_path_spec . TSKPathSpec ( <EOL> location = u'<STR_LIT:/>' , parent = self . _qcow_path_spec ) <EOL> self . _tsk_file_system = tsk_file_system . TSKFileSystem ( <EOL> self . _resolver_context ) <EOL> self . _tsk_file_system . Open ( self . _tsk_path_spec ) <EOL> def testResolvePathDirectory ( self ) : <EOL> """<STR_LIT>""" <EOL> path_resolver = windows_path_resolver . WindowsPathResolver ( <EOL> self . _os_file_system , self . _os_path_spec ) <EOL> expected_path = os . path . join ( <EOL> os . getcwd ( ) , u'<STR_LIT>' , u'<STR_LIT>' , u'<STR_LIT>' ) <EOL> windows_path = u'<STR_LIT>' <EOL> path_spec = path_resolver . ResolvePath ( windows_path ) <EOL> self . assertIsNotNone ( path_spec ) <EOL> self . assertEqual ( path_spec . location , expected_path ) <EOL> test_windows_path = path_resolver . GetWindowsPath ( path_spec ) <EOL> self . assertEqual ( test_windows_path , windows_path ) <EOL> windows_path = u'<STR_LIT>' <EOL> path_spec = path_resolver . ResolvePath ( windows_path ) <EOL> self . assertIsNone ( path_spec ) <EOL> def testResolvePathImage ( self ) : <EOL> """<STR_LIT>""" <EOL> path_resolver = windows_path_resolver . WindowsPathResolver ( <EOL> self . _tsk_file_system , self . _qcow_path_spec ) <EOL> expected_path = ( <EOL> u'<STR_LIT>' ) <EOL> windows_path = ( <EOL> u'<STR_LIT>' <EOL> u'<STR_LIT>' ) <EOL> path_spec = path_resolver . ResolvePath ( windows_path ) <EOL> self . assertIsNotNone ( path_spec ) <EOL> self . assertEqual ( path_spec . location , expected_path ) <EOL> test_windows_path = path_resolver . GetWindowsPath ( path_spec ) <EOL> self . assertEqual ( test_windows_path , windows_path ) <EOL> windows_path = ( <EOL> u'<STR_LIT>' <EOL> u'<STR_LIT>' ) <EOL> path_spec = path_resolver . ResolvePath ( windows_path ) <EOL> self . assertIsNotNone ( path_spec ) <EOL> self . assertEqual ( path_spec . location , expected_path ) <EOL> windows_path = ( <EOL> u'<STR_LIT>' <EOL> u'<STR_LIT>' ) <EOL> path_spec = path_resolver . ResolvePath ( windows_path ) <EOL> self . assertIsNotNone ( path_spec ) <EOL> self . assertEqual ( path_spec . location , expected_path ) <EOL> expected_path = u'<STR_LIT>' <EOL> windows_path = u'<STR_LIT>' <EOL> path_spec = path_resolver . ResolvePath ( windows_path ) <EOL> self . assertIsNotNone ( path_spec ) <EOL> self . assertEqual ( path_spec . location , expected_path ) <EOL> windows_path = u'<STR_LIT>' <EOL> path_spec = path_resolver . ResolvePath ( windows_path ) <EOL> self . assertIsNotNone ( path_spec ) <EOL> self . assertEqual ( path_spec . location , expected_path ) <EOL> expected_path = u'<STR_LIT:/>' <EOL> windows_path = u'<STR_LIT:\\>' <EOL> path_spec = path_resolver . ResolvePath ( windows_path ) <EOL> self . assertIsNotNone ( path_spec ) <EOL> self . assertEqual ( path_spec . location , expected_path ) <EOL> windows_path = u'<STR_LIT:S>' <EOL> path_spec = path_resolver . ResolvePath ( windows_path ) <EOL> self . assertIsNone ( path_spec ) <EOL> windows_path = u'<STR_LIT>' <EOL> path_spec = path_resolver . ResolvePath ( windows_path ) <EOL> self . assertIsNone ( path_spec ) <EOL> windows_path = u'<STR_LIT>' <EOL> path_spec = path_resolver . ResolvePath ( windows_path ) <EOL> self . assertIsNone ( path_spec ) <EOL> windows_path = u'<STR_LIT>' <EOL> path_spec = path_resolver . ResolvePath ( windows_path ) <EOL> self . assertIsNone ( path_spec ) <EOL> windows_path = u'<STR_LIT>' <EOL> path_spec = path_resolver . ResolvePath ( windows_path ) <EOL> self . assertIsNone ( path_spec ) <EOL> windows_path = u'<STR_LIT>' <EOL> path_spec = path_resolver . ResolvePath ( windows_path ) <EOL> self . assertIsNone ( path_spec ) <EOL> windows_path = u'<STR_LIT>' <EOL> path_spec = path_resolver . ResolvePath ( windows_path ) <EOL> self . assertIsNone ( path_spec ) <EOL> windows_path = u'<STR_LIT>' <EOL> path_spec = path_resolver . ResolvePath ( windows_path ) <EOL> self . assertIsNone ( path_spec ) <EOL> def testResolvePathWithEnvironmentVariable ( self ) : <EOL> """<STR_LIT>""" <EOL> path_resolver = windows_path_resolver . WindowsPathResolver ( <EOL> self . _tsk_file_system , self . _qcow_path_spec ) <EOL> path_resolver . SetEnvironmentVariable ( <EOL> u'<STR_LIT>' , u'<STR_LIT>' ) <EOL> expected_path = ( <EOL> u'<STR_LIT>' ) <EOL> windows_path = u'<STR_LIT>' <EOL> path_spec = path_resolver . ResolvePath ( windows_path ) <EOL> self . assertIsNotNone ( path_spec ) <EOL> self . assertEqual ( path_spec . location , expected_path ) <EOL> expected_windows_path = ( <EOL> u'<STR_LIT>' <EOL> u'<STR_LIT>' ) <EOL> test_windows_path = path_resolver . GetWindowsPath ( path_spec ) <EOL> self . assertEqual ( test_windows_path , expected_windows_path ) <EOL> windows_path = u'<STR_LIT>' <EOL> path_spec = path_resolver . ResolvePath ( windows_path ) <EOL> self . assertIsNone ( path_spec ) <EOL> path_resolver = windows_path_resolver . WindowsPathResolver ( <EOL> self . _os_file_system , self . _os_path_spec ) <EOL> expected_path = os . path . join ( <EOL> os . getcwd ( ) , u'<STR_LIT>' , u'<STR_LIT>' , u'<STR_LIT>' , u'<STR_LIT>' ) <EOL> path_resolver . SetEnvironmentVariable ( u'<STR_LIT>' , u'<STR_LIT>' ) <EOL> windows_path = u'<STR_LIT>' <EOL> path_spec = path_resolver . ResolvePath ( windows_path ) <EOL> self . assertIsNotNone ( path_spec ) <EOL> self . assertEqual ( path_spec . location , expected_path ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> unittest . main ( ) </s>
