Esempio n. 1
0
 def test__read_json_with_comments(self, testdir_class):
     file_content = ('{\n'
                     '// a commented line\n'
                     '"search_timeout": 10,\n'
                     '\n'
                     '// another commented line\n'
                     '"screenshot_on_error": true\n'
                     '}')
     path = os.path.join(testdir_class.path, 'temp_settings01.json')
     with open(path, 'w') as json_file:
         json_file.write(file_content)
     result = settings_manager._read_json_with_comments(path)
     expected = {'search_timeout': 10, 'screenshot_on_error': True}
     assert result == expected
 def test__read_json_with_comments(self, random_testdir_fixture):
     testdir = random_testdir_fixture['path']
     file_content = ('{\n'
                     '// a commented line\n'
                     '"implicit_wait": 10,\n'
                     '\n'
                     '// another commented line\n'
                     '"screenshot_on_error": true\n'
                     '}')
     path = os.path.join(testdir, 'temp_settings01.json')
     with open(path, 'w') as json_file:
         json_file.write(file_content)
     result = settings_manager._read_json_with_comments(path)
     expected = {'implicit_wait': 10, 'screenshot_on_error': True}
     assert result == expected