Skip to content

Conversation

@saurabhkpatel
Copy link
Contributor

…for the same. I need help to resolve one pylint error

After these changes:

Example:

import fire
a="fire"
x = {}
x['y'] = x
fire.Fire()

output:

a:    fire
fire: <module 'fire' from '/Users/srpatel/github/python-fire/fire/__init__.pyc'> [ Error:<module 'fire' from '/Users/srpatel/github/python-fire/fire/__init__.pyc'> is not JSON serializable]
x:    {'y': {...}} 

…for the same. I need help to resolve one pylint error
Copy link
Collaborator

@dbieber dbieber left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the pull request!

Some comments are inline.

self.assertEqual(core._OneLineResult('hello'), 'hello') # pylint: disable=protected-access
self.assertEqual(core._OneLineResult({}), '{}') # pylint: disable=protected-access
self.assertEqual(core._OneLineResult({'x': 'y'}), '{"x": "y"}') # pylint: disable=protected-access
self.assertEqual(core._OneLineResult(self.createCircularRefObject()), # pylint: disable=protected-access
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's make this a new test, "testOneLineResultCircularRef".

Let's also put

x = {}
x['y'] = x

either a) inside the test, or b) as a new component in test_components.py.
I think we should probably go w/ b so that we can reuse the component in other tests (e.g. testing completion script generation, help strings, actual use of Fire, etc).

except (TypeError, ValueError):
return str(result).replace('\n', ' ')


Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

keep this newline.


def testOneLineResultCircularRef(self):
circular_reference = tc.CircularReference()
self.assertEqual(core._OneLineResult(circular_reference.create()),# pylint: disable=protected-access
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add 2 spaces before the "#"?

@dbieber dbieber merged commit a0791c9 into google:master Apr 7, 2017
@saurabhkpatel saurabhkpatel deleted the fix_issue42 branch April 7, 2017 23:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants