def test_five(suite): input = [ { "employee": "Paul", "scan": "enter" }, { "employee": "Paul", "scan": "enter" }, { "employee": "Paul", "scan": "exit" }, { "employee": "Paul", "scan": "enter" }, ] expected = (['Paul'], []) (exits, entries) = get_invalid_logs(input) exits.sort() entries.sort() actual = (exits, entries) suite.is_deep_equal( actual, expected, "returns only one faulty exit per employee when present", )
def test_four(suite): input = [ { "employee": "Paul", "scan": "exit" }, { "employee": "Mary", "scan": "enter" }, { "employee": "Mary", "scan": "exit" }, { "employee": "Ignatius", "scan": "exit" }, { "employee": "Benedict", "scan": "enter" }, { "employee": "Benedict", "scan": "enter" }, { "employee": "Benedict", "scan": "exit" }, { "employee": "Mary", "scan": "enter" }, { "employee": "Mary", "scan": "exit" }, { "employee": "Ignatius", "scan": "enter" }, ] expected = ( ['Benedict', 'Ignatius'], ['Ignatius', 'Paul'], ) (exits, entries) = get_invalid_logs(input) exits.sort() entries.sort() actual = (exits, entries) suite.is_deep_equal( actual, expected, "returns faulty exits and entries when present", )
def test_three(suite): input = [ { "employee": "Paul", "scan": "exit" }, { "employee": "Mary", "scan": "enter" }, { "employee": "Mary", "scan": "exit" }, { "employee": "Gregory", "scan": "exit" }, { "employee": "Mary", "scan": "enter" }, { "employee": "Mary", "scan": "exit" }, { "employee": "Gregory", "scan": "enter" }, { "employee": "Gregory", "scan": "exit" }, ] expected = ([], ['Gregory', 'Paul']) (exits, entries) = get_invalid_logs(input) exits.sort() entries.sort() actual = (exits, entries) suite.is_deep_equal( actual, expected, "returns faulty entries when present", )
def test_one(suite): suite.is_true(isinstance(get_invalid_logs([]), tuple), "returns an Array")