Best Python code snippet using stestr_python
index_test.py
Source:index_test.py
1import unittest2 as unittest2from ipynb.fs.full.index import build_trace, layout, trace_values3class TestPlotly(unittest.TestCase):4 def test_build_trace_returns_dict_with_keys_of_x_and_y(self):5 figurekeys = build_trace([]).keys()6 self.assertEqual(list(figurekeys)[0], 'x')7 self.assertEqual(list(figurekeys)[1], 'y')8 def test_build_trace_sets_x_values_as_value_and_y_values_as_value(self):9 data = [{'x': 1, 'y': 1}, {'x': 3, 'y': 2}, {'x': 2, 'y': 5}]10 test_trace = build_trace(data)11 self.assertEqual(test_trace['x'], [1, 3, 2])12 self.assertEqual(test_trace['y'], [1, 2, 5])13 def test_build_trace_takes_second_argument_as_mode_set_to_value_of_mode_key(self):14 data = [{'x': 1, 'y': 1}, {'x': 3, 'y': 2}, {'x': 2, 'y': 5}]15 test_trace = build_trace(data, 'markers')16 self.assertEqual(test_trace['mode'], 'markers')17 def test_build_trace_mode_is_set_to_markers_by_default(self):18 data = [{'x': 1, 'y': 1}, {'x': 3, 'y': 2}, {'x': 2, 'y': 5}]19 test_trace = build_trace(data)20 self.assertEqual(test_trace['mode'], 'markers')21 def test_build_trace_accepts_argument_of_name_set_to_default_argument_of_data(self):22 data = [{'x': 1, 'y': 1}, {'x': 3, 'y': 2}, {'x': 2, 'y': 5}]23 test_trace = build_trace(data)24 self.assertEqual(test_trace['name'], 'data')25 def test_trace_values(self):26 test_trace = trace_values([1, 2, 3], [2, 4, 5], 'line', 'line trace')27 self.assertEqual(test_trace, {'mode': 'line', 'name': 'line trace', 'x': [1, 2, 3], 'y': [2, 4, 5]})28 def test_layout_returns_dictionary(self):29 self.assertTrue(isinstance(layout(), dict))30 def test_layout_returns_dictionary(self):31 self.assertTrue(isinstance(layout(), dict))32 def test_layout_adds_x_axis(self):33 self.assertTrue(layout([1, 5], {'xaxis': {'range': [1, 5]}}))34 def test_layout_adds_y_axis(self):35 self.assertTrue(layout(y_range = [2, 5]), {'yaxis': {'range': [2, 5]}})36 def test_layout_adds_x_axis_and_y_axis(self):37 self.assertTrue(layout(y_range = [2, 5], x_range = [3, 6]), {'yaxis': {'range': [2, 5]}, 'xaxis': {'range': [3, 6]}})38 def test_layout_adds_an_options_argument(self):...
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!