From 91b5dc497d8fa210871e136b7f21c38796469016 Mon Sep 17 00:00:00 2001 From: "Haoyu (Daniel)" Date: Sun, 20 Oct 2024 14:06:02 +0800 Subject: [PATCH] try to fix linting error, #702 --- tests/test_json.py | 25 ++++++++++++------------- tests/test_serialization.py | 5 ++--- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/tests/test_json.py b/tests/test_json.py index 097f1f534..055c8428b 100644 --- a/tests/test_json.py +++ b/tests/test_json.py @@ -9,6 +9,17 @@ from typing import Union import numpy as np +import pytest +from monty.json import ( + MontyDecoder, + MontyEncoder, + MSONable, + _load_redirect, + jsanitize, + load, +) + +from . import __version__ as TESTS_VERSION try: import pandas as pd @@ -35,18 +46,6 @@ except ImportError: ObjectId = None -import pytest -from monty.json import ( - MontyDecoder, - MontyEncoder, - MSONable, - _load_redirect, - jsanitize, - load, -) - -from . import __version__ as tests_version - TEST_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), "test_files") @@ -317,7 +316,7 @@ def test_unsafe_hash(self): def test_version(self): obj = self.good_cls("Hello", "World", "Python") d = obj.as_dict() - assert d["@version"] == tests_version + assert d["@version"] == TESTS_VERSION def test_nested_to_from_dict(self): GMC = GoodMSONClass diff --git a/tests/test_serialization.py b/tests/test_serialization.py index d2e0cf9cb..6d1e8ab9a 100644 --- a/tests/test_serialization.py +++ b/tests/test_serialization.py @@ -6,15 +6,14 @@ import unittest import pytest +from monty.serialization import dumpfn, loadfn +from monty.tempfile import ScratchDir try: import msgpack except ImportError: msgpack = None -from monty.serialization import dumpfn, loadfn -from monty.tempfile import ScratchDir - class TestSerial: @classmethod