Details
Diff Detail
Event Timeline
bindings/python/tests/cindex/test_cdb.py | ||
---|---|---|
67 | Cant we use expected[0]['file'] here rather than duplicating the filename? |
bindings/python/tests/cindex/test_cdb.py | ||
---|---|---|
67 | We can't because the expected array in this test is just the command line, it is different from the one in test_all_compilecommand where it represents the command line + file + directory. I'm fine making a local variable to hold this filename so that we can have: file = '/home/john.doe/MyProject/project.cpp' cmds = cdb.getCompileCommands(file) assert len(cmds) == 1 assert cmds[0].directory == '/home/john.doe/MyProject' assert cmds[0].filename == file Do you think it's better? |
Right, I mixed up the scope. Actually, I like the suggestion. You can change the other assert to use 'os.path.dirname' and avoid that being duplicated as well.
Cant we use expected[0]['file'] here rather than duplicating the filename?