Best Python code snippet using autotest_python
java_class_file.py
Source:java_class_file.py
...58 f.close()59class DOJavaClassMako(JavaClassMako):60 def __init__(self, project, java_class):61 super(DOJavaClassMako, self).__init__(project, java_class, path + '/tl/service/do.tl')62 java_class.set_package('entity')63 java_class.set_class_name_suffix('DO')64class VOJavaClassMako(JavaClassMako):65 def __init__(self, project, java_class):66 super(VOJavaClassMako, self).__init__(project, java_class, path + '/tl/api/vo.tl')67 java_class.set_package('vo')68 java_class.set_class_name_suffix('VO')69class DTOJavaClassMako(JavaClassMako):70 def __init__(self, project, java_class):71 super(DTOJavaClassMako, self).__init__(project, java_class, path + '/tl/api/dto.tl')72 java_class.set_package('dto')73 java_class.set_class_name_suffix('DTO')74class EnumJavaClassMako(JavaClassMako):75 def __init__(self, project, java_class):76 super(EnumJavaClassMako, self).__init__(project, java_class, path + '/tl/api/enum.tl')77 java_class.set_package('enums')78 java_class.set_class_name_suffix('Enum')79class MapperJavaClassMako(JavaClassMako):80 def __init__(self, project, java_class):81 super(MapperJavaClassMako, self).__init__(project, java_class, path + '/tl/service/mapper/mapper.tl')82 java_class.set_package('repository.mapper')83 java_class.set_class_name_suffix('Mapper')84class MapperXmlMako(ResourceMako):85 def __init__(self, project, java_class):86 super(MapperXmlMako, self).__init__(project, java_class, path + '/tl/service/mapper/mapperXml.tl')87 java_class.set_package('repository.mapper')88 java_class.set_class_name_suffix('Mapper')89class TableCommandServiceClassMako(JavaClassMako):90 def __init__(self, project, java_class):91 super(TableCommandServiceClassMako, self).__init__(project, java_class, path + '/tl/service/table/commandService.tl')92 java_class.set_package('command')93 java_class.set_class_name_suffix('CommandService')94class TableCommandServiceImplClassMako(JavaClassMako):95 def __init__(self, project, java_class):96 super(TableCommandServiceImplClassMako, self).__init__(project, java_class, path + '/tl/service/table/commandServiceImpl.tl')97 java_class.set_package('command.impl')98 java_class.set_class_name_suffix('CommandServiceImpl')99class TableQueryServiceClassMako(JavaClassMako):100 def __init__(self, project, java_class):101 super(TableQueryServiceClassMako, self).__init__(project, java_class, path + '/tl/service/table/queryService.tl')102 java_class.set_package('query')103 java_class.set_class_name_suffix('QueryService')104class TableQueryServiceImplClassMako(JavaClassMako):105 def __init__(self, project, java_class):106 super(TableQueryServiceImplClassMako, self).__init__(project, java_class, path + '/tl/service/table/queryServiceImpl.tl')107 java_class.set_package('query.impl')108 java_class.set_class_name_suffix('QueryServiceImpl')109class TableRepsoitoryClassMako(JavaClassMako):110 def __init__(self, project, java_class):111 super(TableRepsoitoryClassMako, self).__init__(project, java_class, path + '/tl/service/table/repository.tl')112 java_class.set_package('repository')113 java_class.set_class_name_suffix('Repository')114class TableRspositoryImplClassMako(JavaClassMako):115 def __init__(self, project, java_class):116 super(TableRspositoryImplClassMako, self).__init__(project, java_class, path + '/tl/service/table/repositoryImpl.tl')117 java_class.set_package('repository.impl')118 java_class.set_class_name_suffix('RepositoryImpl')119class TableAdminControllerMako(JavaClassMako):120 def __init__(self, project, java_class):121 super(TableAdminControllerMako, self).__init__(project, java_class, path + '/tl/controller/table/adminController.tl')122 # java_class.set_package('admin.controller')123 java_class.set_class_name_suffix('Controller')124 java_class.set_class_name_prefix('Admin')125class AdminControllerMako(JavaClassMako):126 def __init__(self, project, java_class):127 super(AdminControllerMako, self).__init__(project, java_class, path + '/tl/controller/adminController.tl')128 # java_class.set_package('admin.controller')129 java_class.set_class_name_suffix('Controller')...
test_java_parameters.py
Source:test_java_parameters.py
...24 comp = JavaParameters()25 comp.set_language_path('C:\Tests\CompilerProjectBugFix\Compiler_AT_Project/third_parties/java/jdk-13.0.2/bin')26 comp.set_file_path('C:\Tests\CompilerProjectBugFix\Compiler_AT_Project/media/808eb9893815d1931afaea1dfe57dfb6/java/13.0.2/projectjava/src/com/Main.java')27 comp.set_binary('C:\Tests\CompilerProjectBugFix\Compiler_AT_Project/media/808eb9893815d1931afaea1dfe57dfb6/java/13.0.2/projectjava/bin')28 comp.set_package('C:\Tests\CompilerProjectBugFix\Compiler_AT_Project/media/808eb9893815d1931afaea1dfe57dfb6/java/13.0.2/projectjava/src')29 self.assertTrue(comp.validate())30 def test_invalid_all_parameters_none(self):31 comp = JavaParameters()32 comp.set_language_path(None)33 comp.set_file_path(None)34 comp.set_binary(None)35 comp.set_package(None)36 with self.assertRaises(NoneParametersException):37 comp.validate()38 def test_invalid_parameter_file_path_none(self):39 comp = JavaParameters()40 comp.set_language_path('java')41 comp.set_file_path(None)42 comp.set_binary('/media/project/bin')43 comp.set_package('/media/project/src/com')44 with self.assertRaises(NoneParametersException):45 comp.validate()46 def test_invalid_parameter_language_path_none(self):47 comp = JavaParameters()48 comp.set_language_path(None)49 comp.set_file_path('/media/project')50 comp.set_binary('/media/project/bin')51 comp.set_package('/media/project/src/com')52 with self.assertRaises(NoneParametersException):53 comp.validate()54 def test_invalid_parameter_binary_none(self):55 comp = JavaParameters()56 comp.set_language_path('java')57 comp.set_file_path('/media/project')58 comp.set_binary(None)59 comp.set_package('/media/project/src/com')60 with self.assertRaises(NoneParametersException):61 comp.validate()62 def test_invalid_parameter_package_none(self):63 comp = JavaParameters()64 comp.set_language_path('java')65 comp.set_file_path('/media/project')66 comp.set_binary('/media/project/bin')67 comp.set_package(None)68 with self.assertRaises(NoneParametersException):69 comp.validate()70 def test_invalid_all_parameters_empty(self):71 comp = JavaParameters()72 comp.set_language_path('')73 comp.set_file_path('')74 comp.set_binary('')75 comp.set_package('')76 with self.assertRaises(EmptyParametersException):77 comp.validate()78 def test_invalid_parameter_file_path_empty(self):79 comp = JavaParameters()80 comp.set_language_path('java')81 comp.set_file_path('')82 comp.set_binary('/media/project/bin')83 comp.set_package('/media/project/src/com')84 with self.assertRaises(EmptyParametersException):85 comp.validate()86 def test_invalid_parameter_language_path_empty(self):87 comp = JavaParameters()88 comp.set_language_path('')89 comp.set_file_path('/media/project')90 comp.set_binary('/media/project/bin')91 comp.set_package('/media/project/src/com')92 with self.assertRaises(EmptyParametersException):93 comp.validate()94 def test_invalid_parameter_binary_empty(self):95 comp = JavaParameters()96 comp.set_language_path('java')97 comp.set_file_path('/media/project')98 comp.set_binary('')99 comp.set_package('/media/project/src/com')100 with self.assertRaises(EmptyParametersException):101 comp.validate()102 def test_invalid_parameter_package_empty(self):103 comp = JavaParameters()104 comp.set_language_path('java')105 comp.set_file_path('/media/project')106 comp.set_binary('/media/project/bin')107 comp.set_package('')108 with self.assertRaises(EmptyParametersException):109 comp.validate()110 def test_invalid_all_parameters_nofound(self):111 comp = JavaParameters()112 comp.set_language_path('/third_parties/c++')113 comp.set_file_path('/media/project/')114 comp.set_binary('media/binary')115 comp.set_package('media/package')116 with self.assertRaises(NotFoundParametersException):...
test_ProductUnitConversion.py
Source:test_ProductUnitConversion.py
...6 def setUp(self) -> None:7 self.grocy = Grocy(self.url, self.api_key)8 def test_unit_price1(self):9 product = self.grocy.get_product_obj('Pepsi Max')10 product.set_package(6, 2, 94.70, 1)11 self.assertEqual(15.78, product.stock_unit_price)12 product.set_package(9, 4, 94.70, 1)13 self.assertEqual(15.78, product.stock_unit_price)14 self.assertEqual(6, product.stock_amount)15 def test_unit_price2(self):16 product = self.grocy.get_product_obj('Maxboller')17 with self.assertRaises(exceptions.MissingConversionException, msg='No conversion found for product 10 from 5 to 2'):18 product.set_package(420, 5, 59.40, 1)19 # self.assertEqual(1, product.stock_amount)20 # self.assertEqual(59.40, product.stock_unit_price)21 def test_default_conversion(self):22 product = self.grocy.get_product_obj('Lefsegodt')23 product.set_default_package(18.40, 1)24 self.assertEqual(6, product.stock_amount)25 self.assertEqual(3.07, product.stock_unit_price)26 def test_unit_price3(self):27 product = self.grocy.get_product_obj('Eplejuice')28 product.set_package(1.75, 4, 34.90, 4)29 self.assertEqual(7, product.stock_amount)30 self.assertEqual(19.94, product.stock_unit_price)31 def test_unit_price4(self):32 product = self.grocy.get_product_obj('Eplejuice')33 product.set_package(1, 3, 139.61/4, 4)34 self.assertEqual(7, product.stock_amount)35 self.assertEqual(19.94, product.stock_unit_price)36 def test_invalid_conversion(self):37 product = self.grocy.get_product_obj('Eplejuice')38 with self.assertRaises(exceptions.MissingConversionException, msg='No conversion found for product 1 from 5 to 4'):39 product.set_package(1, 5, 139.61/4, 4)40 def test_get_quantity_unit(self):41 unit = self.grocy.conversion.get_quantity('l')42 self.assertEqual('liter', unit['name'])43 unit = self.grocy.conversion.get_quantity('stk')44 self.assertEqual('stk', unit['name'])45 unit = self.grocy.conversion.get_quantity('pakke')46 self.assertEqual(3, unit['id'])47 def test_get_invalid_quantity_unit(self):48 with self.assertRaises(exceptions.InvalidUnitException, msg='Unknown unit: kilogram'):49 self.grocy.conversion.get_quantity('kilogram')50 def test_get_quantity_dict_abbreviation(self):51 values = self.grocy.conversion.get_quantity_dict()52 self.assertIn('l', values.keys())53 def test_get_quantity_dict_name_plural(self):...
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!!