Skip to content

Commit

Permalink
fix: Table.order_by sorts None as equal to None
Browse files Browse the repository at this point in the history
  • Loading branch information
jpmckinney committed Jan 29, 2025
1 parent c49f090 commit deaf9c4
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 8 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
1.13.0 - Jan 29, 2025
---------------------

- fix: :meth:`.Table.order_by` sorts None as equal to None.

1.12.0 - July 29, 2024
----------------------

Expand Down
8 changes: 4 additions & 4 deletions agate/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ class NullOrder:
def __lt__(self, other):
return False

def __gt__(self, other):
if other is None:
return False
def __eq__(self, other):
return isinstance(other, NullOrder)

return True
def __gt__(self, other):
return not isinstance(other, NullOrder)


class Quantiles(Sequence):
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

project = 'agate'
copyright = '2017, Christopher Groskopf'
version = '1.12.0'
version = '1.13.0'
release = version

# -- General configuration ---------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setup(
name='agate',
version='1.12.0',
version='1.13.0',
description='A data analysis library that is optimized for humans instead of machines.',
long_description=long_description,
long_description_content_type='text/x-rst',
Expand Down
4 changes: 2 additions & 2 deletions tests/test_table/test_order_py.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@ def test_order_by_nulls(self):
self.assertRows(new_table, [
rows[2],
rows[0],
rows[1],
rows[3]
rows[3],
rows[1]
])

def test_order_by_with_row_names(self):
Expand Down

0 comments on commit deaf9c4

Please sign in to comment.