a0d57fc65e
Co-authored-by: Cursor <cursoragent@cursor.com>
35 lines
1.3 KiB
Python
35 lines
1.3 KiB
Python
import unittest
|
|
|
|
from key_monitor_lib import (
|
|
BOX_BREAKOUT_CLOSE_OPPOSITE,
|
|
box_breakout_invalidate_by_mark,
|
|
box_breakout_invalidate_edge_label,
|
|
)
|
|
|
|
|
|
class BoxBreakoutInvalidateTests(unittest.TestCase):
|
|
def test_short_invalidates_above_upper(self):
|
|
self.assertTrue(box_breakout_invalidate_by_mark("short", 62.511, 61.746, 60.569))
|
|
|
|
def test_short_stays_valid_inside_or_below(self):
|
|
self.assertFalse(box_breakout_invalidate_by_mark("short", 61.0, 61.746, 60.569))
|
|
self.assertFalse(box_breakout_invalidate_by_mark("short", 60.0, 61.746, 60.569))
|
|
|
|
def test_long_invalidates_below_lower(self):
|
|
self.assertTrue(box_breakout_invalidate_by_mark("long", 94.0, 100.0, 95.0))
|
|
|
|
def test_long_stays_valid_inside_or_above(self):
|
|
self.assertFalse(box_breakout_invalidate_by_mark("long", 98.0, 100.0, 95.0))
|
|
self.assertFalse(box_breakout_invalidate_by_mark("long", 101.0, 100.0, 95.0))
|
|
|
|
def test_edge_label(self):
|
|
self.assertEqual(box_breakout_invalidate_edge_label("long"), "下沿")
|
|
self.assertEqual(box_breakout_invalidate_edge_label("short"), "上沿")
|
|
|
|
def test_close_reason_constant(self):
|
|
self.assertEqual(BOX_BREAKOUT_CLOSE_OPPOSITE, "box_opposite_break")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|