示例#1
0
def test_get_notes():
    try:
        notebook_1 = _get_notebook()
        result = notebook_1.notes
        expected = [Note("Test1", "Test1.", ["test1"], color="yellow"),
                    Note("Test2", "Test2.", ["test2"], color="yellow")]
        assertion = result == expected
    except Exception as e:
        print(e)
        assertion = False

    assert assertion
示例#2
0
def test_reorder_success():
    try:
        notebook = _get_notebook()
        notebook.reorder([0, 1])
        note_1 = Note("Test2", "Test2.", ["test2"], color="yellow")
        note_2 = Note("Test1", "Test1.", ["test1"], color="yellow")

        expected = Notebook([note_1, note_2])
        assertion = notebook == expected
    except Exception as e:
        print(e)
        assertion = False

    assert assertion
示例#3
0
def test_add_one_note():
    try:
        notebook = _get_notebook()
        note_1 = Note("Test1", "Test1.", ["test1"], color="yellow")
        note_2 = Note("Test2", "Test2.", ["test2"], color="yellow")
        note_3 = Note("Test3", "Test3.", ["test3"], color="yellow")
        notebook.add_notes(note_3)

        expected = Notebook([note_1, note_2, note_3])
        assertion = notebook == expected
    except Exception as e:
        print(e)
        assertion = False

    assert assertion
示例#4
0
def test_duplicate_error():
    try:
        note = _get_note()
        result = Note("Test1", "test", ["test"], color="yellow")
        expected = _get_note()
        assertion = result != expected
    except Exception as e:
        print(e)
        assertion = False

    assert assertion
示例#5
0
def test_is_eq_error_index():
    try:
        notebook_1 = _get_notebook()
        notebook_2 = _get_notebook()
        note_3 = Note("Test3", "Test3.", ["test3"], color="yellow")
        notebook_2.add_notes(note_3)
        assertion = notebook_1 != notebook_2
    except Exception as e:
        print(e)
        assertion = False

    assert assertion
示例#6
0
def test_remove_one_note():
    try:
        notebook = _get_notebook()
        note_2 = Note("Test2", "Test2.", ["test2"], color="yellow")
        notebook.remove_notes(0)

        expected = Notebook([note_2])
        assertion = notebook == expected
    except Exception as e:
        print(e)
        assertion = False

    assert assertion
示例#7
0
def test_set_notes():
    try:
        notebook = _get_notebook()
        note_3 = Note("Test3", "Test3.", ["test3"], color="yellow")
        notebook.notes = [note_3]

        result = notebook.tags
        expected = {"test3"}
        assertion = result == expected
    except Exception as e:
        print(e)
        assertion = False

    assert assertion
示例#8
0
def test__update_tags():
    try:
        notebook = _get_notebook()
        note_3 = Note("Test3", "Test3.", ["test3"], color="yellow")
        notebook.add_notes(note_3)

        result = notebook.tags
        expected = {"test1", "test2", "test3"}
        assertion = result == expected
    except Exception as e:
        print(e)
        assertion = False

    assert assertion
示例#9
0
def _get_note():
    note = Note("Test", "test", ["test"], color="yellow")
    return note
示例#10
0
def _get_notebook():
    note_1 = Note("Test1", "Test1.", ["test1"], color="yellow")
    note_2 = Note("Test2", "Test2.", ["test2"], color="yellow")
    notebook = Notebook([note_1, note_2])
    return notebook