Skip to content
Snippets Groups Projects
Verified Commit 9592cc56 authored by Frank Sauerburger's avatar Frank Sauerburger
Browse files

Test for new cut.call behavior

With the new behavior, cuts should return the events directly when called. This
change breaks existing code.
parent abda4ddb
No related branches found
No related tags found
No related merge requests found
...@@ -241,3 +241,15 @@ class CutTestCase(unittest.TestCase): ...@@ -241,3 +241,15 @@ class CutTestCase(unittest.TestCase):
[True, True, False, False, False, True, True, False]) [True, True, False, False, False, True, True, False])
self.assertEqual(list(self.df[selected].year), self.assertEqual(list(self.df[selected].year),
[2010, 2011, 2015, 2016]) [2010, 2011, 2015, 2016])
def test_call(self):
"""
Check that calling the cut returns a dataframe containing the events
rather than returning an index array.
"""
high_sale = Cut(lambda df: df.sale > 4)
high_sale_years = high_sale(self.df)
self.assertEqual(list(high_sale_years.sale), [4.7, 5.6, 7.5, 4.2])
self.assertEqual(list(high_sale_years.year), [2012, 2013, 2014, 2017])
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment