implement fill color option for boxes, start wx integration
This commit is contained in:
@ -19,4 +19,4 @@ if __name__ == '__main__':
|
||||
loader = unittest.TestLoader()
|
||||
cases = [loader.loadTestsFromTestCase(module) for module in TEST_CASES]
|
||||
suite = unittest.TestSuite(cases)
|
||||
unittest.TextTestRunner().run(suite)
|
||||
unittest.TextTestRunner(verbosity=2).run(suite)
|
||||
@ -1,13 +1,10 @@
|
||||
import unittest
|
||||
import pandas as pd
|
||||
from util import BARS
|
||||
from util import BARS, Tester
|
||||
from lightweight_charts import Chart
|
||||
|
||||
|
||||
class TestChart(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.chart = Chart()
|
||||
|
||||
class TestChart(Tester):
|
||||
def test_data_is_renamed(self):
|
||||
uppercase_df = pd.DataFrame(BARS.copy()).rename({'date': 'Date', 'open': 'OPEN', 'high': 'HIgh', 'low': 'Low', 'close': 'close', 'volUME': 'volume'})
|
||||
result = self.chart._df_datetime_format(uppercase_df)
|
||||
@ -19,9 +16,6 @@ class TestChart(unittest.TestCase):
|
||||
self.assertEqual(result0, self.chart.lines()[0])
|
||||
self.assertEqual(result1, self.chart.lines()[1])
|
||||
|
||||
def tearDown(self):
|
||||
self.chart.exit()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@ -15,7 +15,7 @@ class TestReturns(Tester):
|
||||
self.assertIsNotNone(screenshot_data)
|
||||
|
||||
def test_save_drawings(self):
|
||||
self.chart.exit()
|
||||
|
||||
|
||||
async def main():
|
||||
asyncio.create_task(self.chart.show_async());
|
||||
@ -28,7 +28,7 @@ class TestReturns(Tester):
|
||||
self.assertTrue(len(self.chart.toolbox.drawings) > 0)
|
||||
self.chart.exit()
|
||||
|
||||
self.chart = Chart(toolbox=True, debug=True)
|
||||
self.chart = Chart(toolbox=True, width=100, height=100)
|
||||
self.chart.set(BARS)
|
||||
self.chart.topbar.textbox('symbol', 'SYM', align='right')
|
||||
self.chart.toolbox.save_drawings_under(self.chart.topbar['symbol'])
|
||||
|
||||
@ -2,21 +2,20 @@ import unittest
|
||||
import pandas as pd
|
||||
|
||||
from lightweight_charts import Chart
|
||||
from util import Tester
|
||||
|
||||
|
||||
class TestTopBar(unittest.TestCase):
|
||||
class TestTopBar(Tester):
|
||||
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)
|
||||
self.chart.topbar.switcher('a', ('1', '2'), func=lambda c: (self.assertEqual(c.topbar['a'].value, '2'), c.exit()))
|
||||
self.chart.run_script(f'{self.chart.topbar["a"].id}.intervalElements[1].dispatchEvent(new Event("click"))')
|
||||
self.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)
|
||||
self.chart.topbar.button('a', '1', func=lambda c: (self.assertEqual(c.topbar['a'].value, '2'), c.exit()))
|
||||
self.chart.topbar['a'].set('2')
|
||||
self.chart.run_script(f'{self.chart.topbar["a"].id}.elem.dispatchEvent(new Event("click"))')
|
||||
self.chart.show(block=True)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
Reference in New Issue
Block a user