示例#1
0
 def test_module_library(self):
     lib = TestLibrary("module_library")
     assert_equal(lib.__class__, _ModuleLibrary)
 def _test_init_handler(self, libname, args=None, min=0, max=0):
     lib = TestLibrary(libname, args)
     assert_equal(lib.init.arguments.minargs, min)
     assert_equal(lib.init.arguments.maxargs, max)
     return lib
 def _verify_doc_format(self, name, doc_format):
     assert_equal(TestLibrary(name).doc_format, doc_format)
 def test_import_java_with_dots(self):
     lib = TestLibrary("javapkg.JavaPackageExample")
     self._verify_lib(lib, "javapkg.JavaPackageExample", java_keywords)
 def test_suite_scope_java(self):
     self._verify_scope(TestLibrary('javalibraryscope.Suite'), 'SUITE')
 def test_test_scope(self):
     self._verify_scope(TestLibrary('libraryscope.Test'), 'TEST')
     self._verify_scope(TestLibrary('libraryscope.TestCase'), 'TEST')
 def test_invalid_scope_is_mapped_to_test_scope(self):
     for libname in ['libraryscope.InvalidValue',
                     'libraryscope.InvalidEmpty',
                     'libraryscope.InvalidMethod',
                     'libraryscope.InvalidNone']:
         self._verify_scope(TestLibrary(libname), 'TEST')
示例#8
0
 def test_dynamic_python_library(self):
     lib = TestLibrary("RunKeywordLibrary")
     assert_equal(lib.__class__, _DynamicLibrary)
示例#9
0
 def test_get_keyword_doc_and_args_are_ignored_if_not_callable(self):
     lib = TestLibrary('InvalidAttributeArgDocDynamicJavaLibrary')
     assert_equal(len(lib.handlers), 1)
     assert_handler_args(lib.handlers['keyword'], 0, sys.maxsize)
示例#10
0
 def test_get_keyword_doc_and_args_are_ignored_if_not_callable(self):
     lib = TestLibrary('classes.InvalidAttributeDynamicLibrary')
     assert_equal(len(lib.handlers), 5)
     assert_equal(lib.handlers['No Arg'].doc, '')
     assert_handler_args(lib.handlers['No Arg'], 0, sys.maxsize)
示例#11
0
 def test_handler_is_not_created_if_get_keyword_args_fails(self):
     lib = TestLibrary('classes.InvalidGetArgsDynamicLibrary')
     assert_equal(len(lib.handlers), 0)
示例#12
0
 def test_get_keyword_doc_is_used_if_present(self):
     lib = TestLibrary('classes.ArgDocDynamicLibrary')
     assert_equal(lib.handlers['No Arg'].doc,
                  'Keyword documentation for No Arg')
示例#13
0
 def test_extending_java_lib_in_python(self):
     handlers = TestLibrary('extendingjava.ExtendJavaLib').handlers
     assert_equal(len(handlers), 25)
     for handler in 'kw_in_java_extender', 'javaSleep', 'divByZero':
         assert_true(handler in handlers)
示例#14
0
 def test_overridden_getName(self):
     handlers = TestLibrary('OverrideGetName').handlers
     assert_equal(sorted(handler.name for handler in handlers),
                  ['Do Nothing', 'Get Name'])
示例#15
0
 def test_import_with_unicode_name(self):
     self._verify_lib(TestLibrary(u"BuiltIn"), "BuiltIn", default_keywords)
     self._verify_lib(TestLibrary(u"robot.libraries.BuiltIn.BuiltIn"),
                      "robot.libraries.BuiltIn.BuiltIn", default_keywords)
     self._verify_lib(TestLibrary(u"pythonmodule.library"), "pythonmodule.library",
                      [("keyword from submodule", None)])
示例#16
0
 def test_handler_is_not_created_if_get_keyword_doc_fails(self):
     lib = TestLibrary('InvalidSignatureArgDocDynamicJavaLibrary')
     assert_equal(len(lib.handlers), 0)
示例#17
0
 def test_suite_scope(self):
     self._verify_scope(TestLibrary('libraryscope.Suite'), 'SUITE')
     self._verify_scope(TestLibrary('libraryscope.TestSuite'), 'SUITE')
示例#18
0
 def test_java_library(self):
     lib = TestLibrary("ExampleJavaLibrary")
     assert_equal(lib.__class__, _ClassLibrary)
示例#19
0
 def test_task_scope_is_mapped_to_test_scope(self):
     self._verify_scope(TestLibrary('libraryscope.Task'), 'TEST')
示例#20
0
 def test_failure_in_dynamic_resolving_of_doc(self):
     init = TestLibrary('dynlibs.FailingDynamicDocLib').init
     assert_raises(DataError, getattr, init, 'doc')
示例#21
0
 def test_import_java(self):
     lib = TestLibrary("ExampleJavaLibrary")
     self._verify_lib(lib, "ExampleJavaLibrary", java_keywords)
示例#22
0
 def _assert_init_doc(self, library_name, expected_doc):
     assert_equal(TestLibrary(library_name).init.doc, expected_doc)
示例#23
0
 def test_global_scope_java(self):
     self._verify_scope(TestLibrary('javalibraryscope.Global'), 'GLOBAL')
示例#24
0
 def test_import_python_class_from_module(self):
     lib = TestLibrary("BuiltIn.BuiltIn")
     self._verify_lib(lib, "BuiltIn.BuiltIn", default_keywords)
示例#25
0
 def test_test_scope_java(self):
     self._verify_scope(TestLibrary('javalibraryscope.Test'), 'TEST')
示例#26
0
 def test_import_python_module(self):
     lib = TestLibrary("module_library")
     kws = [
         "passing", "two arguments from class", "lambdakeyword", "argument"
     ]
     self._verify_lib(lib, "module_library", [(kw, None) for kw in kws])
示例#27
0
 def _verify_version(self, name, version):
     assert_equal(TestLibrary(name).version, version)
示例#28
0
 def test_import_python_module_from_module(self):
     lib = TestLibrary("pythonmodule.library")
     self._verify_lib(lib, "pythonmodule.library",
                      [("keyword from submodule", None)])
示例#29
0
 def test_python_library(self):
     lib = TestLibrary("BuiltIn")
     assert_equal(lib.__class__, _ClassLibrary)
     assert_equal(lib.positional_args, [])
示例#30
0
 def test_python_library_with_args(self):
     lib = TestLibrary("ParameterLibrary", ['my_host', '8080'])
     assert_equal(lib.__class__, _ClassLibrary)
     assert_equal(lib.positional_args, ['my_host', '8080'])