From 05d45f54e5981a4b0d8b972e5b77249f86f2551f Mon Sep 17 00:00:00 2001 From: David Gardner <96306125+dagardner-nv@users.noreply.github.com> Date: Fri, 17 Mar 2023 12:48:57 -0700 Subject: [PATCH] Fix intermittent test failure in tests/test_message_meta.py (#772) We had two tests that set values on row 3, however we now randomly duplicate the index, causing a situation where 3 might not exist in the index. Authors: - David Gardner (https://github.com/dagardner-nv) Approvers: - Michael Demoret (https://github.com/mdemoret-nv) URL: https://github.com/nv-morpheus/Morpheus/pull/772 --- tests/test_message_meta.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/test_message_meta.py b/tests/test_message_meta.py index 7e225ad6f1..689c0339b1 100644 --- a/tests/test_message_meta.py +++ b/tests/test_message_meta.py @@ -105,9 +105,9 @@ def test_mutable_dataframe(df: cudf.DataFrame): meta = MessageMeta(df) with meta.mutable_dataframe() as df: - df['v2'][3] = 47 + df['v2'].iloc[3] = 47 - assert meta.copy_dataframe()['v2'][3] == 47 + assert meta.copy_dataframe()['v2'].iloc[3] == 47 def test_using_ctx_outside_with_block(df: cudf.DataFrame): @@ -136,5 +136,6 @@ def test_copy_dataframe(df: cudf.DataFrame): assert copied_df is not df, "But should be different instances" # Try setting a single value on the copy - meta.copy_dataframe()['v2'][3] = 47 + cdf = meta.copy_dataframe() + cdf['v2'].iloc[3] = 47 assert assert_df_equal(meta.copy_dataframe(), df), "Should be identical"