Skip to content

Commit 2b49057

Browse files
committed
Move variables outside of the for loop to improve performance
1 parent ef4a9c3 commit 2b49057

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

pandas/tests/io/json/test_ujson.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -558,18 +558,18 @@ def test_decode_number_with_32bit_sign_bit(self, val):
558558

559559
def test_encode_big_escape(self):
560560
# Make sure no Exception is raised.
561+
base = "\u00e5".encode()
562+
escape_input = base * 1024 * 1024 * 2
561563
for _ in range(10):
562-
base = "\u00e5".encode()
563-
escape_input = base * 1024 * 1024 * 2
564564
ujson.ujson_dumps(escape_input)
565565

566566
def test_decode_big_escape(self):
567567
# Make sure no Exception is raised.
568-
for _ in range(10):
569-
base = "\u00e5".encode()
570-
quote = b'"'
568+
base = "\u00e5".encode()
569+
quote = b'"'
571570

572-
escape_input = quote + (base * 1024 * 1024 * 2) + quote
571+
escape_input = quote + (base * 1024 * 1024 * 2) + quote
572+
for _ in range(10):
573573
ujson.ujson_loads(escape_input)
574574

575575
def test_to_dict(self):

0 commit comments

Comments
 (0)