Skip to content

Conversation

steventlamb
Copy link
Contributor

No description provided.

Steve Lamb added 4 commits February 4, 2014 11:34
the comparison loop was using zip(), which will only pair values up to the length of the shorter sequence. So in this case, if your test data had 3 rows, but your output data only had 2, the test would still pass even though that's clearly not OK. Using izip_longest() with padding, all elements of the two sequences are paired together.

Also factor out this method so it can be used by another class.
It is useful to have more test data in the main dataset, so I moved Ged there. This will be necessary for doing more advanced ORM operations in tests of newer features.
One of the unit tests caught this - nontruthy values were being discarded on export. Yikes.
This addresses a bit of a pain point in the best way I can think of. Normally, you can specify column ordering in the .values() call to the Queryset. This works fine for normal fields, and for walking relationships, but unfortunately does not work for extra_select fields. When support was added for extra_select fields, they were just tacked on to the end of the regular ordering. We now provide a 'field_order' argument that takes a list of field names to use for ordering when including extra_select data.

As the tests show, a complete ordering is not required. The default order is to honor the order provided by the Model class, or the .values() call with extra_select fields added at the end. Any fields put in the ordering list will be placed at the beginning, and everything else will be added at the end, honoring their previous ordering rule.
@coveralls
Copy link

Coverage Status

Coverage remained the same when pulling fe64911 on steventlamb:topic/add_support_for_ordering into fd0076b on azavea:master.

@maurizi
Copy link
Contributor

maurizi commented Feb 4, 2014

+1

steventlamb pushed a commit that referenced this pull request Feb 4, 2014
@steventlamb steventlamb merged commit eab5cb6 into azavea:master Feb 4, 2014
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.

3 participants