2021-12-16 12:11:49 +00:00
|
|
|
from habitmove.parser import Parser, NomieParser
|
2021-12-24 20:52:57 +00:00
|
|
|
from inspect import signature
|
2021-12-16 12:11:49 +00:00
|
|
|
|
|
|
|
|
|
|
|
def test_parser_interface_exists():
|
|
|
|
sut = Parser()
|
|
|
|
assert type(sut) == Parser
|
|
|
|
|
|
|
|
|
|
|
|
def test_parser_interface_contains_methods():
|
|
|
|
sut = Parser()
|
|
|
|
assert sut.__getattribute__("parse") != None
|
2021-12-24 20:52:57 +00:00
|
|
|
assert sut.__getattribute__("load_file") != None
|
2021-12-16 12:11:49 +00:00
|
|
|
assert sut.__getattribute__("extract_version") != None
|
|
|
|
assert sut.__getattribute__("extract_trackers") != None
|
|
|
|
assert sut.__getattribute__("extract_events") != None
|
|
|
|
|
|
|
|
|
2021-12-24 20:52:57 +00:00
|
|
|
def test_parser_load_file_returns_parser():
|
|
|
|
sut = Parser().load_file
|
|
|
|
assert signature(sut).return_annotation == "Parser"
|
|
|
|
|
|
|
|
|
|
|
|
def test_parser_parse_returns_Import_Data():
|
|
|
|
sut = Parser().parse
|
|
|
|
assert signature(sut).return_annotation == "ImportData"
|
|
|
|
|
|
|
|
|
|
|
|
def test_parser_version_returns_String():
|
|
|
|
sut = Parser().extract_version
|
|
|
|
assert signature(sut).return_annotation == "str"
|
|
|
|
|
|
|
|
|
|
|
|
def test_parser_extract_trackers_returns_tracker_list():
|
|
|
|
sut = Parser().extract_trackers
|
|
|
|
assert signature(sut).return_annotation == "list[Tracker]"
|
|
|
|
|
|
|
|
|
|
|
|
def test_parser_extract_events_returns_event_list():
|
|
|
|
sut = Parser().extract_events
|
|
|
|
assert signature(sut).return_annotation == "list[Event]"
|
|
|
|
|
|
|
|
|
2021-12-16 12:11:49 +00:00
|
|
|
def test_nomie_parser_exists():
|
|
|
|
sut = NomieParser()
|
|
|
|
assert type(sut) == NomieParser
|