2.0 first commit

This commit is contained in:
louisnw
2024-03-30 15:38:34 +00:00
parent a91ea493d7
commit e9f21b3b0e
69 changed files with 4081 additions and 2107 deletions

23
test/test_topbar.py Normal file
View File

@ -0,0 +1,23 @@
import unittest
import pandas as pd
from lightweight_charts import Chart
class TestTopBar(unittest.TestCase):
def test_switcher_fires_event(self):
chart = Chart()
chart.topbar.switcher('a', ('1', '2'), func=lambda c: (self.assertEqual(c.topbar['a'].value, '2'), c.exit()))
chart.run_script(f'{chart.topbar["a"].id}.intervalElements[1].dispatchEvent(new Event("click"))')
chart.show(block=True)
def test_button_fires_event(self):
chart = Chart()
chart.topbar.button('a', '1', func=lambda c: (self.assertEqual(c.topbar['a'].value, '2'), c.exit()))
chart.topbar['a'].set('2')
chart.run_script(f'{chart.topbar["a"].id}.elem.dispatchEvent(new Event("click"))')
chart.show(block=True)
if __name__ == '__main__':
unittest.main()