How to use test_presenter method in SeleniumBase

Best Python code snippet using SeleniumBase

test_presenter.py

Source: test_presenter.py Github

copy

Full Screen

1import unittest2from .read import Read3from .alignment import Alignment4from .reference import Reference5from .presenter import Presenter6class TestPresenter(unittest.TestCase):7 def create_aligned_pairs(self, read_sequence, reference_positions):8 return tuple(zip(range(len(read_sequence)), reference_positions))9 def create_test_reference(self, name):10 self.n20 = "aaaatttc"11 self.sequence = "tactactacaaaatttccggt"12 self.pam = "ngg"13 reference_positions_a = [8, None, None, None, 9, 10, 11, None, None, None, None, 12, 13, 14]14 seq_a = "ctttaaattttatt"15 read_a = Read("a", reference_positions_a, seq_a, self.create_aligned_pairs(seq_a, reference_positions_a))16 reference_positions_b = [10, 15]17 seq_b = "at"18 read_b = Read("b", reference_positions_b, seq_b, ((0,10),(None, 11), (None, 12), (None, 13), (None, 14), (1, 15)))19 reference_positions_c = [10, 11, 12, 13, 14]20 seq_c = "aaatt"21 read_c = Read("c", reference_positions_c, seq_a, self.create_aligned_pairs(seq_c, reference_positions_c))22 reference_positions_d = [6, 7, 8, 9, 10, 11, 12, 13, None, None, None, None, 14]23 seq_d = "tacaaaattggggt"24 read_d = Read("d", reference_positions_d, seq_d, self.create_aligned_pairs(seq_d, reference_positions_d))25 reference_positions_e = [18, 20]26 seq_e = "gt"27 read_e = Read("e", reference_positions_e, seq_e, ((0,18),(None, 19),(1,20)))28 reference_positions_f = [None, None, None, 0, 1, 2]29 seq_f = "gggtac"30 read_f = Read("f", reference_positions_f, seq_f, self.create_aligned_pairs(seq_f, reference_positions_f))31 reads = [read_a, read_b, read_c, read_d, read_e, read_f]32 return Reference(name, self.n20, self.sequence, self.pam, reads)33 def test_reference_presenter_results(self):34 references = [self.create_test_reference("foo"), self.create_test_reference("bar")]35 test_presenter = Presenter(references)36 results = test_presenter.present()37 self.assertEqual(len(results), 2)38 self.assertEqual(results[0].sequence(), self.sequence.upper())39 self.assertEqual(results[0].n20(), self.n20.upper())40 self.assertEqual(results[0].pam(), self.pam.upper())41 self.assertEqual(results[0].name(), "foo")42 self.assertEqual(len(results[0].mutation_clusters), 1)43 self.assertEqual(results[0].total_reads(), 6)44 self.assertEqual(results[1].sequence(), self.sequence.upper())45 self.assertEqual(results[1].n20(), self.n20.upper())46 self.assertEqual(results[1].pam(), self.pam.upper())47 self.assertEqual(results[1].name(), "bar")48 self.assertEqual(len(results[1].mutation_clusters), 1)49 self.assertEqual(results[1].total_reads(), 6)50 def test_cluster_results(self):51 references = [self.create_test_reference("foo")]52 test_presenter = Presenter(references)53 results = test_presenter.present()54 mutation_clusters = results[0].mutation_clusters55 self.assertEqual(mutation_clusters[0].count(), 1)56 expected = [('A___||_T', 'A___||_T', 'AAAT||TT')]57 actual = []58 for cluster in mutation_clusters:59 got = (cluster.cas9_region.read, cluster.alignments[0].read, cluster.alignments[0].reference)60 actual.append(got)...

Full Screen

Full Screen

ringmaster_test_support.py

Source: ringmaster_test_support.py Github

copy

Full Screen

1"""Test support code for testing Ringmasters."""2from collections import defaultdict3from cStringIO import StringIO4from gomill import ringmasters5from gomill import ringmaster_presenters6class Test_presenter(ringmaster_presenters.Presenter):7 """Presenter which stores the messages."""8 def __init__(self):9 ringmaster_presenters.Presenter.__init__(self)10 self.channels = defaultdict(list)11 shows_warnings_only = False12 def clear(self, channel):13 self.channels[channel] = []14 def say(self, channel, s):15 self.channels[channel].append(s)16 def refresh(self):17 pass18 def recent_messages(self, channel):19 """Retrieve messages sent since the channel was last cleared.20 Returns a list of strings.21 """22 return self.channels[channel][:]23class Testing_ringmaster(ringmasters.Ringmaster):24 """Variant of ringmaster suitable for use in tests.25 This doesn't read from or write to the filesystem.26 (If you're testing run(), make sure record_games is False, and either27 stderr_to_log is False, or else discard_stderr is True for each player.)28 (Currently, write_status is made to do nothing, so it's not usefully29 testable.)30 Instantiate with the control file contents as an 8-bit string.31 It will act as if the control file had been loaded from32 /​nonexistent/​ctl/​test.ctl.33 You'll want to run set_display_mode('test') with this.34 """35 def __init__(self, control_file_contents):36 self._control_file_contents = control_file_contents37 self._test_status = None38 self._written_status = None39 ringmasters.Ringmaster.__init__(self, '/​nonexistent/​ctl/​test.ctl')40 self.set_stdout(StringIO())41 _presenter_classes = {42 'test' : Test_presenter,43 }44 def _open_files(self):45 self.logfile = StringIO()46 self.historyfile = StringIO()47 def _close_files(self):48 # Don't want to close the StringIOs49 pass50 def _read_control_file(self):51 return self._control_file_contents52 def set_test_status(self, test_status):53 """Specify the value that will be loaded from the state file.54 test_status -- fake state file contents55 test_status should be a pair (status_format_version, status dict)56 """57 self._test_status = test_status58 def _load_status(self):59 return self._test_status60 def status_file_exists(self):61 return (self._test_status is not None)62 def _write_status(self, value):63 self._written_status = value64 def retrieve_printed_output(self):...

Full Screen

Full Screen

Blogs

Check out the latest blogs from LambdaTest on this topic:

Feeding your QA Career – Developing Instinctive & Practical Skills

The QA testing profession requires both educational and long-term or experience-based learning. One can learn the basics from certification courses and exams, boot camp courses, and college-level courses where available. However, developing instinctive and practical skills works best when built with work experience.

A Complete Guide To CSS Grid

Ever since the Internet was invented, web developers have searched for the most efficient ways to display content on web browsers.

Keeping Quality Transparency Throughout the organization

In general, software testers have a challenging job. Software testing is frequently the final significant activity undertaken prior to actually delivering a product. Since the terms “software” and “late” are nearly synonymous, it is the testers that frequently catch the ire of the whole business as they try to test the software at the end. It is the testers who are under pressure to finish faster and deem the product “release candidate” before they have had enough opportunity to be comfortable. To make matters worse, if bugs are discovered in the product after it has been released, everyone looks to the testers and says, “Why didn’t you spot those bugs?” The testers did not cause the bugs, but they must bear some of the guilt for the bugs that were disclosed.

A Detailed Guide To Xamarin Testing

Xamarin is an open-source framework that offers cross-platform application development using the C# programming language. It helps to simplify your overall development and management of cross-platform software applications.

How To Run Cypress Tests In Azure DevOps Pipeline

When software developers took years to create and introduce new products to the market is long gone. Users (or consumers) today are more eager to use their favorite applications with the latest bells and whistles. However, users today don’t have the patience to work around bugs, errors, and design flaws. People have less self-control, and if your product or application doesn’t make life easier for users, they’ll leave for a better solution.

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 SeleniumBase 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