style: 代码格式化

This commit is contained in:
2025-12-13 21:47:37 +08:00
parent a0b327cdbb
commit baa7ac8ee9
64 changed files with 755 additions and 573 deletions

View File

@@ -1,6 +1,7 @@
"""
Unit tests for particle modules: Atom, Electron, Nucleon, Orbital, Probe, Loader
"""
import pytest
import json
from pathlib import Path
@@ -10,6 +11,7 @@ from src.heurams.kernel.particles.atom import Atom
from src.heurams.kernel.particles.electron import Electron
from src.heurams.kernel.particles.nucleon import Nucleon
from src.heurams.kernel.particles.orbital import Orbital
# Probe module doesn't have a Probe class, only functions
# Loader module doesn't have a Loader class, only functions
@@ -32,21 +34,18 @@ class TestAtom:
def test_atom_from_dict(self):
"""Test creating Atom from dictionary."""
data = {
"nucleon": {
"content": "What is 2+2?",
"answer": "4"
},
"nucleon": {"content": "What is 2+2?", "answer": "4"},
"electron": {
"ease": 2.5,
"interval": 1,
"repetitions": 0,
"last_review": None
"last_review": None,
},
"orbital": {
"learning_steps": [1, 10],
"graduating_interval": 1,
"easy_interval": 4
}
"easy_interval": 4,
},
}
atom = Atom.from_dict(data)
@@ -87,12 +86,7 @@ class TestElectron:
def test_electron_custom_values(self):
"""Test Electron with custom values."""
test_time = datetime.now(timezone.utc)
electron = Electron(
ease=3.0,
interval=10,
repetitions=5,
last_review=test_time
)
electron = Electron(ease=3.0, interval=10, repetitions=5, last_review=test_time)
assert electron.ease == 3.0
assert electron.interval == 10
@@ -144,10 +138,7 @@ class TestNucleon:
def test_nucleon_from_dict(self):
"""Test creating Nucleon from dictionary."""
data = {
"content": "What is Python?",
"answer": "A programming language"
}
data = {"content": "What is Python?", "answer": "A programming language"}
nucleon = Nucleon.from_dict(data)
@@ -178,9 +169,7 @@ class TestOrbital:
def test_orbital_custom_values(self):
"""Test Orbital with custom values."""
orbital = Orbital(
learning_steps=[2, 15],
graduating_interval=2,
easy_interval=6
learning_steps=[2, 15], graduating_interval=2, easy_interval=6
)
assert orbital.learning_steps == [2, 15]
@@ -189,11 +178,7 @@ class TestOrbital:
def test_orbital_from_dict(self):
"""Test creating Orbital from dictionary."""
data = {
"learning_steps": [3, 20],
"graduating_interval": 3,
"easy_interval": 8
}
data = {"learning_steps": [3, 20], "graduating_interval": 3, "easy_interval": 8}
orbital = Orbital.from_dict(data)
@@ -215,4 +200,4 @@ class TestOrbital:
# TestProbe class removed - probe module only has functions, not a class
# TestLoader class removed - loader module only has functions, not a class
# TestLoader class removed - loader module only has functions, not a class