Skip to content

Conversation

@stasm
Copy link
Contributor

@stasm stasm commented Jun 19, 2017

No description provided.

Copy link
Contributor

@Pike Pike left a comment

Choose a reason for hiding this comment

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

This looks pretty good, just two nits so far.

self_fields = [getattr(self, key) for key in keys]
other_fields = [getattr(other, key) for key in keys]

for key, field1, field2 in izip(keys, self_fields, other_fields):
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd just iterate over keys, unsorted, and assign field1 and field2 inside the loop

'variants': lambda elem: elem.key.name,
}

if key in field_sorting.keys():
Copy link
Contributor

Choose a reason for hiding this comment

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

Just

if key in field_sorting:

@stasm stasm requested a review from Pike June 21, 2017 13:37
Copy link
Contributor

@Pike Pike left a comment

Choose a reason for hiding this comment

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

This looks good to me. Just a few comments about sugar and icing on the tests.

}
""")

self.assertTrue(message1.equals(message1))
Copy link
Contributor

Choose a reason for hiding this comment

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

Does it make sense to test for equality against the identity traversal, too?

If so, add that to the tests in this class?

self.assertTrue(message2.equals(message1))


class TestSpansEqual(unittest.TestCase):
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess the name here is older than your inequality test? Rename this to TestWithSpans or so?

for a, b in messages:
self.assertTrue(a.equals(b, with_spans=True))

def test_differ_with_spans(self):
Copy link
Contributor

Choose a reason for hiding this comment

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

Move this test to the end? Then the four combos of flags to Parser and .equals are all in a row?

@stasm stasm merged commit 73214e4 into projectfluent:master Jun 22, 2017
@stasm stasm deleted the basenode-equals branch June 22, 2017 11:58
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