MCPcopy
hub / github.com/pandas-dev/pandas / run_asserts

Method run_asserts

pandas/tests/reshape/merge/test_multi.py:106–124  ·  view source on GitHub ↗
(left, right, sort)

Source from the content-addressed store, hash-verified

104 return f(df["1st"]) + f(df["3rd"]) * 1e2 + df["2nd"].fillna(0) * 10
105
106 def run_asserts(left, right, sort):
107 res = left.join(right, on=icols, how="left", sort=sort)
108
109 assert len(left) < len(res) + 1
110 assert not res["4th"].isna().any()
111 assert not res["5th"].isna().any()
112
113 tm.assert_series_equal(res["4th"], -res["5th"], check_names=False)
114 result = bind_cols(res.iloc[:, :-2])
115 tm.assert_series_equal(res["4th"], result, check_names=False)
116 assert result.name is None
117
118 if sort:
119 tm.assert_frame_equal(res, res.sort_values(icols, kind="mergesort"))
120
121 out = merge(left, right.reset_index(), on=icols, sort=sort, how="left")
122
123 res.index = RangeIndex(len(res))
124 tm.assert_frame_equal(out, res)
125
126 lc = list(map(chr, np.arange(ord("a"), ord("z") + 1)))
127 left = DataFrame(

Callers

nothing calls this directly

Calls 7

mergeFunction · 0.90
RangeIndexClass · 0.90
joinMethod · 0.45
anyMethod · 0.45
isnaMethod · 0.45
sort_valuesMethod · 0.45
reset_indexMethod · 0.45

Tested by

no test coverage detected