|
7 | 7 | import calendar
|
8 | 8 | import datetime
|
9 | 9 | import decimal
|
10 |
| -from io import StringIO |
11 | 10 | import locale
|
12 | 11 | import math
|
13 | 12 | import re
|
@@ -562,62 +561,6 @@ def test_encode_long_conversion(self):
|
562 | 561 | def test_decode_numeric_int_exp(self, int_exp):
|
563 | 562 | assert ujson.decode(int_exp) == json.loads(int_exp)
|
564 | 563 |
|
565 |
| - def test_dump_to_file(self): |
566 |
| - f = StringIO() |
567 |
| - ujson.dump([1, 2, 3], f) |
568 |
| - assert "[1,2,3]" == f.getvalue() |
569 |
| - |
570 |
| - def test_dump_to_file_like(self): |
571 |
| - class FileLike: |
572 |
| - |
573 |
| - def __init__(self): |
574 |
| - self.bytes = '' |
575 |
| - |
576 |
| - def write(self, data_bytes): |
577 |
| - self.bytes += data_bytes |
578 |
| - |
579 |
| - f = FileLike() |
580 |
| - ujson.dump([1, 2, 3], f) |
581 |
| - assert "[1,2,3]" == f.bytes |
582 |
| - |
583 |
| - def test_dump_file_args_error(self): |
584 |
| - with pytest.raises(TypeError): |
585 |
| - ujson.dump([], "") |
586 |
| - |
587 |
| - def test_load_file(self): |
588 |
| - data = "[1,2,3,4]" |
589 |
| - exp_data = [1, 2, 3, 4] |
590 |
| - |
591 |
| - f = StringIO(data) |
592 |
| - assert exp_data == ujson.load(f) |
593 |
| - |
594 |
| - f = StringIO(data) |
595 |
| - tm.assert_numpy_array_equal(np.array(exp_data), |
596 |
| - ujson.load(f, numpy=True)) |
597 |
| - |
598 |
| - def test_load_file_like(self): |
599 |
| - class FileLike: |
600 |
| - |
601 |
| - def read(self): |
602 |
| - try: |
603 |
| - self.end |
604 |
| - except AttributeError: |
605 |
| - self.end = True |
606 |
| - return "[1,2,3,4]" |
607 |
| - |
608 |
| - exp_data = [1, 2, 3, 4] |
609 |
| - |
610 |
| - f = FileLike() |
611 |
| - assert exp_data == ujson.load(f) |
612 |
| - |
613 |
| - f = FileLike() |
614 |
| - tm.assert_numpy_array_equal(np.array(exp_data), |
615 |
| - ujson.load(f, numpy=True)) |
616 |
| - |
617 |
| - def test_load_file_args_error(self): |
618 |
| - with pytest.raises(TypeError): |
619 |
| - ujson.load("[]") |
620 |
| - |
621 | 564 | def test_loads_non_str_bytes_raises(self):
|
622 | 565 | msg = "Expected 'str' or 'bytes'"
|
623 | 566 | with pytest.raises(TypeError, match=msg):
|
|
0 commit comments