Best Python code snippet using pyshould_python
test_disciplines.py
Source:test_disciplines.py
...12 assert qd.milliseconds == 100013 assert qd.discipline == 'netem delay 1000ms'14 def test_equality(self):15 assert PacketDelay(1000) == PacketDelay(1000)16 def test_inequality(self):17 assert PacketDelay(1000) != PacketDelay(2000)18class TestPacketLoss(unittest.TestCase):19 def test_packet_loss(self):20 qd = PacketLoss(50)21 assert qd.name == 'loss'22 assert qd.percent == 5023 assert qd.discipline == 'netem loss 50%'24 def test_equality(self):25 assert PacketLoss(50) == PacketLoss(50)26 def test_inequality(self):27 assert PacketLoss(50) != PacketLoss(100)28class TestPacketDuplication(unittest.TestCase):29 def test_packet_duplication(self):30 qd = PacketDuplication(50)31 assert qd.name == 'duplicate'32 assert qd.percent == 5033 assert qd.discipline == 'netem duplicate 50%'34 def test_equality(self):35 assert PacketDuplication(50) == PacketDuplication(50)36 def test_inequality(self):37 assert PacketDuplication(50) != PacketDuplication(100)38class TestPacketReordering(unittest.TestCase):39 def test_packet_reordering(self):40 qd = PacketReordering(50, 1000)41 assert qd.name == 'reorder'42 assert qd.percent == 5043 assert qd.milliseconds == 100044 assert qd.discipline == 'netem delay 1000ms reorder 50%'45 def test_equality(self):46 assert PacketReordering(50, 1000) == PacketReordering(50, 1000)47 def test_inequality(self):48 assert PacketReordering(50, 1000) != PacketReordering(10, 1000)49 assert PacketReordering(50, 1000) != PacketReordering(50, 2000)50class TestPacketCorruption(unittest.TestCase):51 def test_packet_corruption(self):52 qd = PacketCorruption(50)53 assert qd.name == 'corrupt'54 assert qd.percent == 5055 assert qd.discipline == 'netem corrupt 50%'56 def test_equality(self):57 assert PacketCorruption(50) == PacketCorruption(50)58 def test_inequality(self):59 assert PacketCorruption(50) != PacketCorruption(100)60class TestRateControl(unittest.TestCase):61 def test_rate_control(self):62 qd = RateControl(1, 2, 3)63 assert qd.name == 'rate'64 assert qd.kbit == 165 assert qd.latency_milliseconds == 266 assert qd.burst_bytes == 367 assert qd.discipline == 'tbf rate 1kbit latency 2ms burst 3'68 def test_equality(self):69 assert RateControl(1, 2, 3) == RateControl(1, 2, 3)70 def test_inequality(self):71 assert RateControl(1, 2, 3) != RateControl(4, 2, 3)72 assert RateControl(1, 2, 3) != RateControl(1, 4, 3)...
vector_test.py
Source:vector_test.py
...4 v1 = Vector([2, 4, 5])5 v2 = Vector([2, 4, 5])6 print(v1 == v2)7 print()8def test_inequality():9 print("Test inequality")10 v1 = Vector([2, 3, 5])11 v2 = Vector([2, 4, 5])12 print(v1 != v2)13 print()14def test_add():15 print("Test add")16 v1 = Vector([2, 3, 5])17 v2 = Vector([2, 4, 5])18 print(v1 + v2)19 print()20def test_mul():21 print("Test add")22 v1 = Vector([2, 3, 5])23 v2 = Vector([2, 4, 5])24 print(v1 * v2)25 print()26test_equality()27test_inequality()28test_add()...
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!!