You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add to_include matcher for collections and cursors #79
A test should fail if expected set contains elements that are not part of actual set.
The exclude/include/join_by should still be respected.
The order should not be relevant, so the behavior should be unordered by default.
The unordered should not be supported
The simplified SQL representation of that comparison would be something like:
--ut.expect(actual).to_include(expected).join_by(pk)
--ut.expect(actual).to_contain(expected).join_by(pk)
select *
from expected
left join actual
on expected.pk = actual.pk
where actual.row is null;
--ut.expect(actual).to_include(expected)
--ut.expect(actual).to_contain(expected)
select *
from expected
left join actual
on expected.row_hash = actual.row_hash
where actual.row_hash is null;
The not_to_inculde should behave differently. As it should fail if any of rows that are expected is included.
--ut.expect(actual).to_include(expected).join_by(pk)
--ut.expect(actual).to_contain(expected).join_by(pk)
select *
from expected
left join actual
on expected.pk = actual.pk
where actual.pk is not null;
--ut.expect(actual).to_include(expected)
--ut.expect(actual).to_contain(expected)
select *
from expected
left join actual
on expected.row_hash = actual.row_hash
where actual.row_hash is not null;
Do you think it's worth implementing? @lwasylow - do you think it would it be difficult to add?
No I don't think it will be hard to implement.
However join_by in such scenarios I think will not give benefit at all as we still want to match a content of the full row so regardless of match on key.
Example:
Included fully ( no feedback to user needed possibly)
2.Not included fully (present result as Expected and Missing )
Partially included ( pk key exists however data content is different, but from logic point of view answer should be still Not Included )
Overall we looking on left outer join instead of full join on existing queries so yeah we should be able to do that fairly easy.
Activity
jgebal commentedon Aug 9, 2018
A test should fail if expected set contains elements that are not part of actual set.
The exclude/include/join_by should still be respected.
The order should not be relevant, so the behavior should be
unorderedby default.The
unorderedshould not be supportedThe simplified SQL representation of that comparison would be something like:
The
not_to_inculdeshould behave differently. As it should fail if any of rows that are expected is included.Do you think it's worth implementing?
@lwasylow - do you think it would it be difficult to add?
lwasylow commentedon Aug 10, 2018
No I don't think it will be hard to implement.
However join_by in such scenarios I think will not give benefit at all as we still want to match a content of the full row so regardless of match on key.
Example:
2.Not included fully (present result as Expected and Missing )
Overall we looking on left outer join instead of full join on existing queries so yeah we should be able to do that fairly easy.
lwasylow commentedon Oct 6, 2018
Do we want to actually highlight differences as well ?
E.g. PK match but value in column is different ?
Or we want to treat that as missing ?