Best Python code snippet using lisa_python
importer_test.py
Source:importer_test.py
...96 streamer.set_message_format_string(97 "{stuff:s} -> {correct!s} [{random_number:d}]"98 )99 streamer.add_data_frame(self.frame)100 self._run_all_tests(streamer.columns, streamer.lines)101 self.assertEqual(len(streamer.lines), 5)102 # Test by splitting up the dataset into chunks.103 lines = None104 columns = None105 with MockStreamer() as streamer:106 streamer.set_sketch(MockSketch())107 streamer.set_timestamp_description("Log Entries")108 streamer.set_timeline_name("Test Entries")109 streamer.set_entry_threshold(2)110 streamer.set_message_format_string(111 "{stuff:s} -> {correct!s} [{random_number:d}]"112 )113 streamer.add_data_frame(self.frame)114 lines = streamer.lines115 columns = streamer.columns116 self._run_all_tests(columns, lines)117 self.assertEqual(len(lines), 5)118 def test_adding_dict(self):119 """Test adding a dict to the importer."""120 with MockStreamer() as streamer:121 streamer.set_sketch(MockSketch())122 streamer.set_timestamp_description("Log Entries")123 streamer.set_timeline_name("Test Entries")124 streamer.set_message_format_string(125 "{stuff:s} -> {correct!s} [{random_number:d}]"126 )127 for entry in self.lines:128 streamer.add_dict(entry)129 streamer.flush()130 self._run_all_tests(streamer.columns, streamer.lines)131 def test_adding_json(self):132 """Test adding a JSON to the importer."""133 with MockStreamer() as streamer:134 streamer.set_sketch(MockSketch())135 streamer.set_timestamp_description("Log Entries")136 streamer.set_timeline_name("Test Entries")137 streamer.set_message_format_string(138 "{stuff:s} -> {correct!s} [{random_number:d}]"139 )140 for entry in self.lines:141 json_string = json.dumps(entry)142 streamer.add_json(json_string)143 streamer.flush()144 self._run_all_tests(streamer.columns, streamer.lines)145 def _run_all_tests(self, columns, lines):146 """Run all tests on the result set of a streamer."""147 # The first line is the column line.148 self.assertEqual(len(lines), 5)149 column_set = set(columns)150 correct_set = set(151 [152 "message",153 "timestamp_desc",154 "datetime",155 "timestamp",156 "vital_stats",157 "random_number",158 "correct",159 "stuff",...
test_mathtext.py
Source:test_mathtext.py
...66 r'${x}_{92}^{31415}+\pi $',67 r'${x}_{{y}_{b}^{a}}^{{z}_{c}^{d}}$',68 r'${y}_{3}^{\prime \prime \prime }$'69]70def _run_all_tests():71 fig = plt.figure(figsize=(5, len(math_tests) / 2.0))72 for i, test in enumerate(math_tests):73 fig.text(0, float(len(math_tests) - i - 1) / len(math_tests), test)74 return fig75@image_comparison(baseline_images=['mathtext'])76def test_mathtext():77 fig = _run_all_tests()78 fig.savefig('mathtext')79@image_comparison(baseline_images=['mathtext_stix'])80def test_mathtext_stix():81 matplotlib.rcParams['mathtext.fontset'] = 'stix'82 fig = _run_all_tests()83 fig.savefig('mathtext_stix')84 matplotlib.rcParams['mathtext.fontset'] = 'cm'85@image_comparison(baseline_images=['mathtext_stixsans'])86def test_mathtext_stixsans():87 matplotlib.rcParams['mathtext.fontset'] = 'stixsans'88 fig = _run_all_tests()89 fig.savefig('mathtext_stixsans')...
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!!