Files
vibemake-pcb-studio/backend/tests/test_persistence_angles.py
T
2026-11-10 19:04:27 +08:00

17 lines
823 B
Python

from pathlib import Path
import sys,unittest
sys.path.insert(0,str(Path(__file__).resolve().parents[1]/'easyeda_backend'))
from design_runtime.persistence import compare
class PersistenceAngles(unittest.TestCase):
def test_equivalent_rotation_does_not_fail_save_reopen(self):
a={'parts':[{'rotation':270}]};b={'parts':[{'rotation':-90.0}]}
result=compare(a,b,'pcb');self.assertTrue(result['matches']);self.assertEqual(len(result['equivalent_rotation_angles']),1)
def test_real_angle_or_geometry_changes_still_fail(self):
self.assertFalse(compare({'parts':[{'rotation':270}]},{'parts':[{'rotation':-89.9}]},'pcb')['matches'])
self.assertFalse(compare({'parts':[{'rotation':270,'x':1}]},{'parts':[{'rotation':-90,'x':2}]},'pcb')['matches'])
if __name__=='__main__':unittest.main()