Best Python code snippet using tempest_python
test_networks.py
Source:test_networks.py
...42 SliceConceptualGraph('test', {}, {}, {})43 SliceConceptualGraph('test', self.midhaul_qos, {}, {})44 SliceConceptualGraph('test', {}, self.backhaul_qos, {})45 SliceConceptualGraph('test', {}, {}, self.parameters)46 def test_get_qos(self):47 self.assertEqual(self.network.get_backhaul(), QoS(self.backhaul_qos))48 def test_set_qos(self):49 self.network.set_backhaul(QoS.minimum_qos_dict)50 self.assertEqual(self.network.get_backhaul(), QoS(QoS.minimum_qos_dict))51 def test_qos_from_distance(self):52 self.assertEqual(self.network.get_qos_from(5).get_formated_qos(), self.parameters.get('worst_qos'))53 self.assertEqual(self.network.get_qos_from(0.0).get_formated_qos(), self.parameters.get('best_qos'))54 def test_get_node_location(self):55 lat, lon = 33, 4056 self.network.set_RU(lat, lon)57 self.network.add_node('test', 10, 10)58 self.assertEqual(self.network.get_node_location('test2'), None)59 self.assertEqual(self.network.get_node_location('test'), Location(10, 10))60 def test_has_to_pass_through_backhaul(self):61 self.network.set_RU(10, 10)62 self.network.set_RU(20, 20)63 self.network.add_node('source1', 10, 10)64 self.network.add_node('destination1', 10, 10)65 self.network.add_node('destination2', 20, 20)66 def test_set_RUs(self):67 self.network.set_RUs([{'lat': 10, 'lon': 10}, {'lat': 5, 'lon': 5}])68 self.assertEqual(self.network.get_RUs(),69 {'10-10': Location(**{'lat': 10, 'lon': 10}), '5-5': Location(**{'lat': 5, 'lon': 5})})70 lat, lon = 33, 4071 self.network.set_RU(lat, lon)72 with self.assertRaises(SliceConceptualGraph.NetworkSliceException):73 self.network.set_RUs([{'lat': 10, 'lon': 10}, {'lat': 5, 'lon': 5}])74 def test_set_node_location(self):75 lat, lon = 33, 4076 self.network.set_RU(lat, lon)77 self.network.add_node('destination1', 10, 10)78 self.network.set_node_location('destination1', 20, 20)79 self.assertEqual(self.network.get_node_location('destination1'), Location(20, 20))80 with self.assertRaises(Location.LocationException):81 self.network.set_node_location('destination1', 'test', 20)82 with self.assertRaises(Location.LocationException):83 self.network.set_node_location('destination1', 20, 'test')84class TestBaseLog2Degradation(unittest.TestCase):85 def setUp(self):86 self.name = "network"87 self.wireless_connection_type = "Log2Degradation"88 self.midhaul_qos = {'latency': {'delay': '3.0ms', 'deviation': '1.0ms'}, 'bandwidth': '100.0mbps',89 'error_rate': '1.0%'}90 self.backhaul_qos = {'latency': {'delay': '3.0ms', 'deviation': '1.0ms'}, 'bandwidth': '100.0mbps',91 'error_rate': '1.0%'}92 self.parameters = dict(93 best_qos={'latency': {'delay': '5.0ms', 'deviation': '2.0ms'}, 'bandwidth': '10.0mbps',94 'error_rate': '1.0%'},95 worst_qos={'latency': {'delay': '100.0ms', 'deviation': '20.0ms'}, 'bandwidth': '5.0mbps',96 'error_rate': '2.0%'}, radius="5km")97 self.network = SliceConceptualGraph(self.name, self.midhaul_qos, self.backhaul_qos, self.parameters)98 def test_creation(self):99 self.assertEqual(self.network.get_name(), "network")100 def test_get_empty_nodes(self):101 self.assertEqual(self.network.get_nodes(), {})102 def test_add_node(self):103 name, lat, lon = 'node', 33, 40104 with self.assertRaises(SliceConceptualGraph.NetworkSliceException):105 self.network.add_node(name, lat, lon)106 self.network.set_RU(33, 40, 0)107 self.network.add_node(name, lat, lon)108 self.assertEqual(self.network.get_nodes(), {'node': Location(lat, lon)})109 with self.assertRaises(SliceConceptualGraph.NetworkSliceException):110 self.network.add_node('node', 33, 40)111 def test_get_empty_RUs(self):112 self.assertEqual(self.network.get_RUs(), {})113 def test_set_basetastion(self):114 lat, lon = 33, 40115 self.network.set_RU(lat, lon)116 self.assertEqual(self.network.get_RUs(), {f'{lat}-{lon}': Location(lat, lon)})117 with self.assertRaises(SliceConceptualGraph.NetworkSliceException):118 self.network.set_RU(lat, lon)119 def test_constructor(self):120 with self.assertRaises(FunctionalDegradation.FunctionDegradationNetworkException):121 SliceConceptualGraph('test', {} ,{}, {})122 SliceConceptualGraph('test', self.midhaul_qos, {}, {})123 SliceConceptualGraph('test', {}, self.backhaul_qos, {})124 SliceConceptualGraph('test', {}, {}, self.parameters)125 def test_get_qos(self):126 self.assertEqual(self.network.get_backhaul(), QoS(self.backhaul_qos))127 def test_set_qos(self):128 self.network.set_backhaul(QoS.minimum_qos_dict)129 self.assertEqual(self.network.get_backhaul(), QoS(QoS.minimum_qos_dict))130 def test_qos_from_distance(self):131 self.assertEqual(self.network.get_qos_from(5).get_formated_qos(), self.parameters.get('worst_qos'))132 self.assertEqual(self.network.get_qos_from(0.0).get_formated_qos(), self.parameters.get('best_qos'))133 def test_get_node_location(self):134 lat, lon = 33, 40135 self.network.set_RU(lat, lon)136 self.network.add_node('test', 10, 10)137 self.assertEqual(self.network.get_node_location('test2'), None)138 self.assertEqual(self.network.get_node_location('test'), Location(10, 10))139 def test_set_RUs(self):...
test-qos.py
Source:test-qos.py
1from __future__ import absolute_import, unicode_literals2import pyslurm3from nose.tools import assert_true4def test_get_qos():5 """QoS: Test get_qos() return type"""6 test_qos = pyslurm.qos().get()...
test_qos.py
Source:test_qos.py
1"""Test cases for QoS."""2import pyslurm3def test_get_qos():4 """QoS: Test get_qos() return type"""5 test_qos = pyslurm.qos().get()...
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!!