-
Notifications
You must be signed in to change notification settings - Fork 28
Improved repr #27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Improved repr #27
Conversation
Pull Request Test Coverage Report for Build 176
💛 - Coveralls |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like you're almost there. Do you mind adding a few tests?
README.md
Outdated
@@ -59,9 +59,22 @@ In [2]: apertium.append_pair_path('..') | |||
|
|||
### Translation | |||
Performing Translations | |||
<<<<<<< HEAD |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Merge conflict artifacts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sushain97 No worries, I'll add tests :)
tests/__init__.py
Outdated
@@ -68,6 +75,14 @@ def test_uninstalled_mode(self): | |||
with self.assertRaises(apertium.ModeNotInstalled): | |||
apertium.generate('spa', 'cat<n><pl>') | |||
|
|||
def test_repr(self): | |||
generator = apertium.Generator('eng') | |||
self.assertEqual(repr(generator), 'Generator(lang=eng)') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These need single quotes. Generator(lang=eng)
itself would error. Similar concern with the others.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sushain97 Just to check if I understand this properly,
The issue is that 'Generator(lang=eng)'
is being returned by the function as a string?
But wasn't that the point of repr, it returns a printable representation of the object
No, the problem is eng should be enclosed in single quotes.
…On Tue, Jul 10, 2018, 6:49 AM Arghya Bhatttacharya ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In tests/__init__.py
<#27 (comment)>
:
> @@ -68,6 +75,14 @@ def test_uninstalled_mode(self):
with self.assertRaises(apertium.ModeNotInstalled):
apertium.generate('spa', 'cat<n><pl>')
+ def test_repr(self):
+ generator = apertium.Generator('eng')
+ self.assertEqual(repr(generator), 'Generator(lang=eng)')
@sushain97 <https://github.com/sushain97> Just to check if I understand
this properly,
The issue is that 'Generator(lang=eng)' is being returned by the function
as a string?
But wasn't that the point of repr, it returns a printable representation
of the object
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#27 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AEBEfvUePK18Kbz6uwG4c-qNzl9xpr0-ks5uFLD1gaJpZM4VGqra>
.
|
@sushain97 But why? I don't quite understand what the problem with the current repr and str function is Sorry for the inconvenience 😅 |
@sushain97 I've changed the code according to my understanding, please review and let me know if I have it right. |
The issue is that |
The |
@sushain97 Could you review this ?