Best Python code snippet using localstack_python
paint.py
Source:paint.py
...16 Point.set_y(p, 20)1718 print("Unbound : p -> x : {}, y : {}".format(Point.get_x(p), Point.get_y(p)))1920def test_lifecycle():21 p1 = Point()22 p1.set_x(10)23 p1.set_y(20)2425 print("Pointì ê°ì²´ ì : ", Point.count_of_instance)26 print("p1 : ", p1)2728 p2 = Point()29 p2.set_x(30)30 p2.set_y(40)3132 print("Pointì ê°ì²´ ì : ", Point.count_of_instance)33 print("p2 : ", p2)3435 del p136 print("Pointì ê°ì²´ ì : ", Point.count_of_instance)37 del p238 print("Pointì ê°ì²´ ì : ", Point.count_of_instance)3940def test_repr():41 # repr í¨ìì ê°ì²´ë¥¼ ë기면 ê°ì²´ ë´ë¶ì __repr__ì´ ìí42 p = Point(x = 30, y = 40)4344 print("__str__ : ", p)45 print("__repr__ : ", repr(p))4647 # __repr__ ë©ìë를 ì¶ë ¥ë 문ìì´ë¡ ë¤ì ê°ì²´ë¥¼ ë³µìí ì ìì´ì¼ íë¤48 p2 = eval(repr(p))4950 print("ë³µìë ê°ì²´ : ", p2)51 print("p == p2 ?", p == p2)5253def test_oper_overloading():54 """55 ì°ì°ì ì¤ë²ë¡ë©56 """57 print("Point + Point :", Point(10,10) + Point(20, 20))58 print("Point + int :", Point(10, 10), 20)5960 # class Point ë´ì __add__를 ì¤ë²ë¡ë© íë° -> ì°ì° ìí61 62 print("int + Point : ", 20 + Point(10, 10))63 # 기본ì ì¸ ì°ì°ì ìí ì¤í¨íì ê²½ì°, ë¤ìª½ í´ëì¤ê°64 # ë¤ì íë² ì ê² í ì ìë¤. -> ìì´í ì°ì°ì6566 p1 = Point(10, 10)67 # eval : 문ìì´ì ì½ëë¡ ì¤íìì¼ì£¼ë í¨ì68 p2 = eval(repr(p1))6970 print("p1 : ", p1)71 print("p2 : ", p2)72 print("p1 == p2? ", p1 == p2) # __eq__ ì¤ë²ë¡ë©7374from point import ColorPoint7576def extend_ex():77 """78 ììë í´ëì¤ì ìì±ê³¼ ì¬ì©79 """80 cp = ColorPoint(10, 20, "RED")81 # ColorPointë Pointê° ê°ì§ 모ë 멤ë²ì ë©ìë를 ìì ë°ìë¤82 print("cp:", cp)8384if __name__ == "__main__":85 # test_bound_instance_method()86 # test_unbound_method()87 # test_lifecycle()88 # test_repr()89 # test_oper_overloading()
...
test_all.py
Source:test_all.py
1'''2Runs all unit tests.3Copyright (c) 2009, 2013 Peter Parente4Permission to use, copy, modify, and distribute this software for any5purpose with or without fee is hereby granted, provided that the above6copyright notice and this permission notice appear in all copies.7THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES8WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF9MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR10ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES11WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN12ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF13OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.14'''15import unittest16import test_say17import test_prop18import test_lifecycle19def suite():20 suite = unittest.TestSuite([21 test_lifecycle.suite(),22 test_prop.suite(),23 test_say.suite()24 ])25 return suite26if __name__ == '__main__':...
test_lifecycle.py
Source:test_lifecycle.py
...28 """29 teardown_class30 """31 print('execution teardown_class()!')32 def test_lifecycle(self):33 """34 test_lifecycle35 """...
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!!