How to use _create_bar method in autotest

Best Python code snippet using autotest_python

test_tab.py

Source:test_tab.py Github

copy

Full Screen

...4from pyecharts.charts import Bar, Line, Tab5from pyecharts.commons.utils import OrderedSet6from pyecharts.components import Table7from pyecharts.faker import Faker8def _create_bar() -> Bar:9 return Bar().add_xaxis(Faker.week).add_yaxis("商家A", [1, 2, 3, 4, 5, 6, 7])10def _create_line() -> Line:11 return Line().add_xaxis(Faker.week).add_yaxis("商家A", [7, 6, 5, 4, 3, 2, 1])12def _create_table() -> Table:13 table = Table()14 headers = ["City name", "Area", "Population", "Annual Rainfall"]15 rows = [16 ["Brisbane", 5905, 1857594, 1146.4],17 ["Adelaide", 1295, 1158259, 600.5],18 ["Darwin", 112, 120900, 1714.7],19 ]20 table.add(headers, rows)21 return table22@patch("pyecharts.render.engine.write_utf8_html_file")23def test_tab_base(fake_writer):24 bar = _create_bar()25 line = _create_line()26 tab = Tab().add(bar, "bar-example").add(line, "line-example")27 tab.render()28 _, content = fake_writer.call_args[0]29 assert_in("bar-example", content)30 assert_in("line-example", content)31def test_tab_render_embed():32 bar = _create_bar()33 line = _create_line()34 content = Tab().add(bar, "bar").add(line, "line").render_embed()35 assert_true(len(content) > 8000)36def test_tab_render_notebook():37 tab = Tab()38 tab.add(_create_line(), "line-example")39 tab.add(_create_bar(), "bar-example")40 tab.add(_create_table(), "table-example")41 html = tab.render_notebook().__html__()42 assert_in("City name", html)43def test_page_jshost_default():44 bar = _create_bar()45 tab = Tab().add(bar, "bar")46 assert_equal(tab.js_host, "https://assets.pyecharts.org/assets/")47def test_tab_jshost_custom():48 from pyecharts.globals import CurrentConfig49 default_host = CurrentConfig.ONLINE_HOST50 custom_host = "http://localhost:8888/assets/"51 CurrentConfig.ONLINE_HOST = custom_host52 bar = _create_bar()53 line = _create_line()54 tab = Tab().add(bar, "bar").add(line, "line")55 assert_equal(tab.js_host, custom_host)56 CurrentConfig.ONLINE_HOST = default_host57def test_tab_iterable():58 tab = Tab()59 assert_true(isinstance(tab, Iterable))60def test_tab_attr():61 tab = Tab()62 assert_true(isinstance(tab.js_functions, OrderedSet))...

Full Screen

Full Screen

test_page.py

Source:test_page.py Github

copy

Full Screen

1from nose.tools import assert_true, eq_2from example.commons import Faker3from pyecharts.charts import Bar, Line, Page4def _create_bar() -> Bar:5 return Bar().add_xaxis(Faker.choose()).add_yaxis("商家A", Faker.values())6def _create_line() -> Line:7 return Line().add_xaxis(Faker.choose()).add_yaxis("商家A", Faker.values())8def test_page_layout_default():9 page = Page()10 eq_(page.layout, "")11def test_page_layout_custom():12 page = Page(layout=Page.SimplePageLayout)13 eq_(page.layout, "justify-content:center; display:flex; flex-wrap:wrap; ")14def test_page_jshost_default():15 bar = _create_bar()16 line = _create_line()17 page = Page().add(bar, line)18 eq_(page.js_host, "https://assets.pyecharts.org/assets/")19def test_page_jshost_custom():20 from pyecharts.globals import CurrentConfig21 default_host = CurrentConfig.ONLINE_HOST22 custom_host = "http://localhost:8888/assets/"23 CurrentConfig.ONLINE_HOST = custom_host24 bar = _create_bar()25 line = _create_line()26 page = Page().add(bar, line)27 eq_(page.js_host, custom_host)28 CurrentConfig.ONLINE_HOST = default_host29def test_page_render_embed():30 bar = _create_bar()31 line = _create_line()32 content = Page().add(bar, line).render_embed()33 assert_true(len(content) > 1000)34def test_page_load_javascript():35 bar = _create_bar()36 line = _create_line()37 content = Page().add(bar, line).load_javascript()38 eq_("", content.data)...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run autotest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful