mirror of
https://github.com/lutris/lutris
synced 2024-09-15 22:09:55 +00:00
24 lines
813 B
Python
24 lines
813 B
Python
|
from unittest import TestCase
|
||
|
from lutris.util import files
|
||
|
|
||
|
|
||
|
class TestFileUtils(TestCase):
|
||
|
def test_file_ids_are_correctly_transformed(self):
|
||
|
file_id = 'foo-bar'
|
||
|
self.assertEqual(files.python_identifier(file_id), 'foo-bar')
|
||
|
|
||
|
file_id = '${foo-bar}'
|
||
|
self.assertEqual(files.python_identifier(file_id), '${foo_bar}')
|
||
|
|
||
|
file_id = '${foo-bar} ${a-b}'
|
||
|
self.assertEqual(files.python_identifier(file_id), '${foo_bar} ${a_b}')
|
||
|
|
||
|
file_id = '${foo-bar} a-b'
|
||
|
self.assertEqual(files.python_identifier(file_id), '${foo_bar} a-b')
|
||
|
|
||
|
file_id = '${foo-bar-bang}'
|
||
|
self.assertEqual(files.python_identifier(file_id), '${foo_bar_bang}')
|
||
|
|
||
|
file_id = '${foo-bar bang}'
|
||
|
self.assertEqual(files.python_identifier(file_id), '${foo-bar bang}')
|