How to use test_custom_arguments method in locust

Best Python code snippet using locust

test_drawing.py

Source: test_drawing.py Github

copy

Full Screen

...307 assert state['stroke_weight'] == 2.0308 assert state['stroke_opacity'] == 0.6309 assert state['fill_color'] == drawing.DEFAULT_FILL_COLOR310 assert state['fill_opacity'] == 0.2311 def test_custom_arguments(self):312 polygon = drawing.Polygon(313 self.path,314 stroke_color=(1, 3, 5),315 stroke_weight=10.0,316 stroke_opacity=0.87,317 fill_color=(7, 9, 11),318 fill_opacity=0.76319 )320 state = polygon.get_state()321 assert state['stroke_color'] == 'rgb(1,3,5)'322 assert state['stroke_weight'] == 10.0323 assert state['stroke_opacity'] == 0.87324 assert state['fill_color'] == 'rgb(7,9,11)'325 assert state['fill_opacity'] == 0.76326 def test_invalid_stroke_opacity(self):327 with self.assertRaises(traitlets.TraitError):328 drawing.Polygon(self.path, stroke_opacity=-0.2)329 with self.assertRaises(traitlets.TraitError):330 drawing.Polygon(self.path, stroke_opacity=1.2)331 with self.assertRaises(traitlets.TraitError):332 drawing.Polygon(self.path, stroke_opacity='not-a-float')333 def test_invalid_fill_opacity(self):334 with self.assertRaises(traitlets.TraitError):335 drawing.Polygon(self.path, fill_opacity=-0.2)336 with self.assertRaises(traitlets.TraitError):337 drawing.Polygon(self.path, fill_opacity=1.2)338 with self.assertRaises(traitlets.TraitError):339 drawing.Polygon(self.path, fill_opacity='not-a-float')340class PolygonOptions(unittest.TestCase):341 def test_to_polygon_defaults(self):342 path = [(10.0, 20.0), (5.0, 30.0), (-5.0, 10.0)]343 expected_polygon = drawing.Polygon(path)344 actual_polygon = drawing.PolygonOptions().to_polygon(path)345 assert actual_polygon.path == expected_polygon.path346 assert actual_polygon.stroke_color == expected_polygon.stroke_color347 assert actual_polygon.stroke_weight == expected_polygon.stroke_weight348 assert actual_polygon.stroke_opacity == expected_polygon.stroke_opacity349 assert actual_polygon.fill_color == expected_polygon.fill_color350 assert actual_polygon.fill_opacity == expected_polygon.fill_opacity351class Circle(unittest.TestCase):352 def setUp(self):353 self.center = (20.0, 24.0)354 self.radius = 4.0e5355 def test_kwargs(self):356 circle = drawing.Circle(center=self.center, radius=self.radius)357 assert circle.get_state()['center'] == self.center358 assert circle.get_state()['radius'] == self.radius359 def test_missing_center(self):360 with self.assertRaises(TypeError):361 drawing.Circle(radius=self.radius)362 def test_missing_radius(self):363 with self.assertRaises(TypeError):364 drawing.Circle(center=self.center)365 def test_defaults(self):366 circle = drawing.Circle(self.center, self.radius)367 state = circle.get_state()368 assert state['stroke_color'] == drawing.DEFAULT_STROKE_COLOR369 assert state['stroke_weight'] == 2.0370 assert state['stroke_opacity'] == 0.6371 assert state['fill_color'] == drawing.DEFAULT_FILL_COLOR372 assert state['fill_opacity'] == 0.2373 def test_custom_arguments(self):374 circle = drawing.Circle(375 self.center,376 self.radius,377 stroke_color=(1, 3, 5),378 stroke_weight=10.0,379 stroke_opacity=0.87,380 fill_color=(7, 9, 11),381 fill_opacity=0.76382 )383 state = circle.get_state()384 assert state['stroke_color'] == 'rgb(1,3,5)'385 assert state['stroke_weight'] == 10.0386 assert state['stroke_opacity'] == 0.87387 assert state['fill_color'] == 'rgb(7,9,11)'...

Full Screen

Full Screen

Blogs

Check out the latest blogs from LambdaTest on this topic:

How To Handle Dynamic Dropdowns In Selenium WebDriver With Java

Joseph, who has been working as a Quality Engineer, was assigned to perform web automation for the company’s website.

Top 17 Resources To Learn Test Automation

Lack of training is something that creates a major roadblock for a tester. Often, testers working in an organization are all of a sudden forced to learn a new framework or an automation tool whenever a new project demands it. You may be overwhelmed on how to learn test automation, where to start from and how to master test automation for web applications, and mobile applications on a new technology so soon.

Migrating Test Automation Suite To Cypress 10

There are times when developers get stuck with a problem that has to do with version changes. Trying to run the code or test without upgrading the package can result in unexpected errors.

Website Testing: A Detailed Guide

Websites and web apps are growing in number day by day, and so are the expectations of people for a pleasant web experience. Even though the World Wide Web (WWW) was invented only in 1989 (32 years back), this technology has revolutionized the world we know back then. The best part is that it has made life easier for us. You no longer have to stand in long queues to pay your bills. You can get that done within a few minutes by visiting their website, web app, or mobile app.

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