import paver.path

import sys
import os.path

def test_join_on_unicode_path():
    merged = b'something/\xc3\xb6'.decode('utf-8') # there is ö after something
    if not os.path.supports_unicode_filenames and sys.version_info[0] < 3:
        merged = merged.encode('utf-8')
    assert merged == os.path.join(paver.path.path('something'), (b'\xc3\xb6').decode('utf-8'))




import paver.path

import sys
import os.path

def test_join_on_unicode_path():
    # This is why we should drop 2.5 asap :]
    # b'' strings are not supported in 2.5, while u'' string are not supported in 3.2
    # -- even syntactically, so if will not help you here
    if sys.version_info[0] < 3:
        expected = 'something/\xc3\xb6'
        unicode_o = '\xc3\xb6'.decode('utf-8')

        # path.py on py2 is inheriting from str instead of unicode under this
        # circumstances, therefore we have to expect string
        if os.path.supports_unicode_filenames:
            expected.decode('utf-8')

    else:
        expected = 'something/ö'
        unicode_o = 'ö'

    assert expected == os.path.join(paver.path.path('something'), unicode_o)




Rewrite unicode join test to work with py25
Rewrite unicode join test to work with py25

  import paver.path
  
  import sys
  import os.path
  
  def test_join_on_unicode_path():
-     merged = b'something/\xc3\xb6'.decode('utf-8') # there is ö after something
-     if not os.path.supports_unicode_filenames and sys.version_info[0] < 3:
-         merged = merged.encode('utf-8')
+     # This is why we should drop 2.5 asap :]
+     # b'' strings are not supported in 2.5, while u'' string are not supported in 3.2
+     # -- even syntactically, so if will not help you here
+     if sys.version_info[0] < 3:
+         expected = 'something/\xc3\xb6'
+         unicode_o = '\xc3\xb6'.decode('utf-8')
+ 
+         # path.py on py2 is inheriting from str instead of unicode under this
+         # circumstances, therefore we have to expect string
+         if os.path.supports_unicode_filenames:
+             expected.decode('utf-8')
+ 
+     else:
+         expected = 'something/ö'
+         unicode_o = 'ö'
+ 
-     assert merged == os.path.join(paver.path.path('something'), (b'\xc3\xb6').decode('utf-8'))
+     assert expected == os.path.join(paver.path.path('something'), unicode_o)
  
  
  
  
Rewrite unicode join test to work with py25
## Code Before:
import paver.path

import sys
import os.path

def test_join_on_unicode_path():
    merged = b'something/\xc3\xb6'.decode('utf-8') # there is ö after something
    if not os.path.supports_unicode_filenames and sys.version_info[0] < 3:
        merged = merged.encode('utf-8')
    assert merged == os.path.join(paver.path.path('something'), (b'\xc3\xb6').decode('utf-8'))




## Instruction:
Rewrite unicode join test to work with py25
## Code After:
import paver.path

import sys
import os.path

def test_join_on_unicode_path():
    # This is why we should drop 2.5 asap :]
    # b'' strings are not supported in 2.5, while u'' string are not supported in 3.2
    # -- even syntactically, so if will not help you here
    if sys.version_info[0] < 3:
        expected = 'something/\xc3\xb6'
        unicode_o = '\xc3\xb6'.decode('utf-8')

        # path.py on py2 is inheriting from str instead of unicode under this
        # circumstances, therefore we have to expect string
        if os.path.supports_unicode_filenames:
            expected.decode('utf-8')

    else:
        expected = 'something/ö'
        unicode_o = 'ö'

    assert expected == os.path.join(paver.path.path('something'), unicode_o)



