-
-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathexamplelibrary1.py
29 lines (20 loc) · 946 Bytes
/
examplelibrary1.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/env python
import os
import sys
from robotremoteserver import RobotRemoteServer
class ExampleLibrary:
"""Example library to be used with Robot Framework's remote server.
This documentation is visible in docs generated by `Libdoc`.
"""
def count_items_in_directory_new(self, path: str) -> int:
"""Returns the number of items in the directory specified by `path`."""
items = [i for i in os.listdir(path) if not i.startswith(".")]
return len(items)
def strings_should_be_equal_new(self, str1: str, str2: str) -> None:
print("Comparing '%s' to '%s'." % (str1, str2))
if not (isinstance(str1, str) and isinstance(str2, str)):
raise TypeError("Given strings are not strings.")
if str1 != str2:
raise AssertionError("Given strings are not equal.")
if __name__ == "__main__":
RobotRemoteServer(ExampleLibrary(), *sys.argv[1:], port=8271)