Mimesis: Test Path in MS Windows.

Created on 28 Nov 2016  路  3Comments  路  Source: lk-geimfari/mimesis

Today has been added class Path that provides methods and property for generate the dummy paths. I tested it only on Linux. It would be great if someone can run all tests on MS Windows.

Usage

>>> from elizabeth import Path

>>> path = Path()

>>> path.root
/
>>> path.home
/home/

>>> path.user(gender='female')
/home/mariko

>>> path.users_folder(user_gender='male')
/home/john/Documents

>>> path.dev_dir()
/home/fidelia/Development/Erlang

# etc.

Most helpful comment

_Ooops... really..._
Now checked, and it turned out that in CLI in Windows-10, -7, you can write path using the '\\', '/', '\', '//'.
I have always thought, and in the Microsoft document it is written, that we should use only '\\'.

Then the question is removed. :-)

All 3 comments

@lk-geimfari, after you fix the problem with the import Path, which we discussed, now

from elizabeth import Path

run correctly.
I tested feature of generating sys.path.
Result:

Python 3.5.1 (v3.5.1:37a07cee5969, Dec 聽6 2015, 01:54:25) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from elizabeth import Path
>>> path = Path()
>>> path.root
'小:\\'
>>> path.home
'小:\\Users\\'
>>> path.user(gender='female')
'小:\\Users\\Jeanice'
>>> path.user(gender='male')
'小:\\Users\\Dudley'
>>> path.users_folder(user_gender='male')
'小:\\Users\\Jerold\\Development'
>>> path.dev_dir(user_gender='female')
'小:\\Users\\Jack\\Development\\AutoIt'
>>> path.project_dir(user_gender='female')
'小:\\Users\\Alla\\Development\\Python\\insidious'

For Windows one of the backslash is superfluous.
I'll try to fix it.

@nebesnytihohod I thought that this format works with Windows. Are you sure that does not work?

_Ooops... really..._
Now checked, and it turned out that in CLI in Windows-10, -7, you can write path using the '\\', '/', '\', '//'.
I have always thought, and in the Microsoft document it is written, that we should use only '\\'.

Then the question is removed. :-)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lk-geimfari picture lk-geimfari  路  5Comments

lk-geimfari picture lk-geimfari  路  4Comments

cryocaustik picture cryocaustik  路  7Comments

lk-geimfari picture lk-geimfari  路  4Comments

lk-geimfari picture lk-geimfari  路  3Comments