()
| 106 | |
| 107 | |
| 108 | def test_downcast_numbers(): |
| 109 | # ints |
| 110 | data = pd.DataFrame( |
| 111 | [[1, 1, 1, 1, 1, 1, 1, 1], [100, 1000, int(1e6), int(1e12), -100, -1000, int(-1e6), int(-1e12)]], |
| 112 | columns=["num1_col", "num2_col", "num3_col", "num4_col", "num5_col", "num6_col", "num7_col", "num8_col"], |
| 113 | ) |
| 114 | downcast_numbers(data) |
| 115 | assert [str(x) for x in data.dtypes] == ["uint8", "uint16", "uint32", "uint64", "int8", "int16", "int32", "int64"] |
| 116 | |
| 117 | # floats - currently disabled |
| 118 | # data = pd.DataFrame( |
| 119 | # [[1.0, 1.0, 1.0, 1.0, 1.0], [1e3, 1e6, 1e12, 1e30, 1e100]], |
| 120 | # columns=["num1_col", "num2_col", "num3_col", "num4_col", "num5_col"], |
| 121 | # ) |
| 122 | # downcast_numbers(data) |
| 123 | # assert [str(x) for x in data.dtypes] == ["float32", "float32", "float32", "float32", "float64"] |
| 124 | |
| 125 | |
| 126 | def test_timedelta_to_str(): |
nothing calls this directly
no test coverage detected