Esempio n. 1
0
 def test_module_library(self):
     lib = TestLibrary("module_library")
     assert_equal(lib.__class__, _ModuleLibrary)
Esempio n. 2
0
 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
Esempio n. 3
0
 def _verify_doc_format(self, name, doc_format):
     assert_equal(TestLibrary(name).doc_format, doc_format)
Esempio n. 4
0
 def test_import_java_with_dots(self):
     lib = TestLibrary("javapkg.JavaPackageExample")
     self._verify_lib(lib, "javapkg.JavaPackageExample", java_keywords)
Esempio n. 5
0
 def test_suite_scope_java(self):
     self._verify_scope(TestLibrary('javalibraryscope.Suite'), 'SUITE')
Esempio n. 6
0
 def test_test_scope(self):
     self._verify_scope(TestLibrary('libraryscope.Test'), 'TEST')
     self._verify_scope(TestLibrary('libraryscope.TestCase'), 'TEST')
Esempio n. 7
0
 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')
Esempio n. 8
0
 def test_dynamic_python_library(self):
     lib = TestLibrary("RunKeywordLibrary")
     assert_equal(lib.__class__, _DynamicLibrary)
Esempio n. 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)
Esempio n. 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)
Esempio n. 11
0
 def test_handler_is_not_created_if_get_keyword_args_fails(self):
     lib = TestLibrary('classes.InvalidGetArgsDynamicLibrary')
     assert_equal(len(lib.handlers), 0)
Esempio n. 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')
Esempio n. 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)
Esempio n. 14
0
 def test_overridden_getName(self):
     handlers = TestLibrary('OverrideGetName').handlers
     assert_equal(sorted(handler.name for handler in handlers),
                  ['Do Nothing', 'Get Name'])
Esempio n. 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)])
Esempio n. 16
0
 def test_handler_is_not_created_if_get_keyword_doc_fails(self):
     lib = TestLibrary('InvalidSignatureArgDocDynamicJavaLibrary')
     assert_equal(len(lib.handlers), 0)
Esempio n. 17
0
 def test_suite_scope(self):
     self._verify_scope(TestLibrary('libraryscope.Suite'), 'SUITE')
     self._verify_scope(TestLibrary('libraryscope.TestSuite'), 'SUITE')
Esempio n. 18
0
 def test_java_library(self):
     lib = TestLibrary("ExampleJavaLibrary")
     assert_equal(lib.__class__, _ClassLibrary)
Esempio n. 19
0
 def test_task_scope_is_mapped_to_test_scope(self):
     self._verify_scope(TestLibrary('libraryscope.Task'), 'TEST')
Esempio n. 20
0
 def test_failure_in_dynamic_resolving_of_doc(self):
     init = TestLibrary('dynlibs.FailingDynamicDocLib').init
     assert_raises(DataError, getattr, init, 'doc')
Esempio n. 21
0
 def test_import_java(self):
     lib = TestLibrary("ExampleJavaLibrary")
     self._verify_lib(lib, "ExampleJavaLibrary", java_keywords)
Esempio n. 22
0
 def _assert_init_doc(self, library_name, expected_doc):
     assert_equal(TestLibrary(library_name).init.doc, expected_doc)
Esempio n. 23
0
 def test_global_scope_java(self):
     self._verify_scope(TestLibrary('javalibraryscope.Global'), 'GLOBAL')
Esempio n. 24
0
 def test_import_python_class_from_module(self):
     lib = TestLibrary("BuiltIn.BuiltIn")
     self._verify_lib(lib, "BuiltIn.BuiltIn", default_keywords)
Esempio n. 25
0
 def test_test_scope_java(self):
     self._verify_scope(TestLibrary('javalibraryscope.Test'), 'TEST')
Esempio n. 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])
Esempio n. 27
0
 def _verify_version(self, name, version):
     assert_equal(TestLibrary(name).version, version)
Esempio n. 28
0
 def test_import_python_module_from_module(self):
     lib = TestLibrary("pythonmodule.library")
     self._verify_lib(lib, "pythonmodule.library",
                      [("keyword from submodule", None)])
Esempio n. 29
0
 def test_python_library(self):
     lib = TestLibrary("BuiltIn")
     assert_equal(lib.__class__, _ClassLibrary)
     assert_equal(lib.positional_args, [])
Esempio n. 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'])