Skip to content

Commit

Permalink
review
Browse files Browse the repository at this point in the history
  • Loading branch information
hauntsaninja authored and hukkin committed Oct 8, 2024
1 parent 8d1a199 commit 19e83d0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
9 changes: 0 additions & 9 deletions tests/test_error.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
# SPDX-FileCopyrightText: 2021 Taneli Hukkinen
# Licensed to PSF under a Contributor Agreement.

import io
import unittest

from . import tomllib
Expand Down Expand Up @@ -65,11 +64,3 @@ def list_returner(s: str) -> list:
self.assertEqual(
str(exc_info.exception), "parse_float must not return dicts or lists"
)

def test_text_mode_error(self):
with self.assertRaises(TypeError) as exc_info:
tomllib.load(io.StringIO()) # type: ignore[arg-type]
self.assertEqual(
str(exc_info.exception),
"File must be opened in binary mode, e.g. use `open('foo.toml', 'rb')`",
)
6 changes: 5 additions & 1 deletion tests/test_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,12 @@ def test_incorrect_load(self):
file_path.write_text(content)

with open(file_path, "r") as txt_f:
with self.assertRaises(TypeError):
with self.assertRaises(TypeError) as exc_info:
tomllib.load(txt_f) # type: ignore[arg-type]
self.assertEqual(
str(exc_info.exception),
"File must be opened in binary mode, e.g. use `open('foo.toml', 'rb')`",
)

def test_parse_float(self):
doc = """
Expand Down

0 comments on commit 19e83d0

Please sign in to comment.