Skip to content

Commit deaf9c4

Browse files
committed
fix: Table.order_by sorts None as equal to None
1 parent c49f090 commit deaf9c4

File tree

5 files changed

+13
-8
lines changed

5 files changed

+13
-8
lines changed

CHANGELOG.rst

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
1.13.0 - Jan 29, 2025
2+
---------------------
3+
4+
- fix: :meth:`.Table.order_by` sorts None as equal to None.
5+
16
1.12.0 - July 29, 2024
27
----------------------
38

agate/utils.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,11 @@ class NullOrder:
4646
def __lt__(self, other):
4747
return False
4848

49-
def __gt__(self, other):
50-
if other is None:
51-
return False
49+
def __eq__(self, other):
50+
return isinstance(other, NullOrder)
5251

53-
return True
52+
def __gt__(self, other):
53+
return not isinstance(other, NullOrder)
5454

5555

5656
class Quantiles(Sequence):

docs/conf.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
project = 'agate'
1414
copyright = '2017, Christopher Groskopf'
15-
version = '1.12.0'
15+
version = '1.13.0'
1616
release = version
1717

1818
# -- General configuration ---------------------------------------------------

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
setup(
77
name='agate',
8-
version='1.12.0',
8+
version='1.13.0',
99
description='A data analysis library that is optimized for humans instead of machines.',
1010
long_description=long_description,
1111
long_description_content_type='text/x-rst',

tests/test_table/test_order_py.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,8 @@ def test_order_by_nulls(self):
131131
self.assertRows(new_table, [
132132
rows[2],
133133
rows[0],
134-
rows[1],
135-
rows[3]
134+
rows[3],
135+
rows[1]
136136
])
137137

138138
def test_order_by_with_row_names(self):

0 commit comments

Comments
 (0)