(self)
| 38 | tomllib.load(txt_f) # type: ignore[arg-type] |
| 39 | |
| 40 | def test_parse_float(self): |
| 41 | doc = """ |
| 42 | val=0.1 |
| 43 | biggest1=inf |
| 44 | biggest2=+inf |
| 45 | smallest=-inf |
| 46 | notnum1=nan |
| 47 | notnum2=-nan |
| 48 | notnum3=+nan |
| 49 | """ |
| 50 | obj = tomllib.loads(doc, parse_float=D) |
| 51 | expected = { |
| 52 | "val": D("0.1"), |
| 53 | "biggest1": D("inf"), |
| 54 | "biggest2": D("inf"), |
| 55 | "smallest": D("-inf"), |
| 56 | "notnum1": D("nan"), |
| 57 | "notnum2": D("-nan"), |
| 58 | "notnum3": D("nan"), |
| 59 | } |
| 60 | for k, expected_val in expected.items(): |
| 61 | actual_val = obj[k] |
| 62 | self.assertIsInstance(actual_val, D) |
| 63 | if actual_val.is_nan(): |
| 64 | self.assertTrue(expected_val.is_nan()) |
| 65 | else: |
| 66 | self.assertEqual(actual_val, expected_val) |
| 67 | |
| 68 | def test_deepcopy(self): |
| 69 | doc = """ |
nothing calls this directly
no test coverage detected