Example #1
0
def test_tracker_spec_merge_duplicate():
    assignments = [FolderAssignment("1=folder"), FolderAssignment("1=another")]

    with pytest.raises(SpecError) as e:
        _ = TrackerSpec._merge(assignments)

    assert "duplicate" in e.value.message
Example #2
0
def test_validate_indices():
    with pytest.raises(SpecError) as e:
        FolderAssignment("a,2=folder")._validate_indices()

    assert "integer" in e.value.message
Example #3
0
def test_tracker_spec_merge():
    assignments = [FolderAssignment("1=folder")]
    result = TrackerSpec._merge(assignments)

    assert result == {1: "folder"}
Example #4
0
def test_validate_split_parts():
    with pytest.raises(SpecError) as e:
        _ = FolderAssignment._validate_folder_name("")

    assert "empty" in e.value.message
Example #5
0
def test_validate_split_parts_invalid_length():
    with pytest.raises(SpecError) as e:
        _ = FolderAssignment._validate_split_parts(["a", "a", "a"])

    assert "delimited" in e.value.message
Example #6
0
def test_folder_assignment_non_alphanum_folder_name():
    with pytest.raises(SpecError) as e:
        _ = FolderAssignment._validate_folder_name("notalphanumeric!")

    assert "alphanumeric" in e.value.message
Example #7
0
def test_folder_assignment_folder():
    assert FolderAssignment("1,2,3=folder").folder == "folder"
Example #8
0
def test_folder_assignment_indices():
    assert FolderAssignment("1,2,3=folder").indices == {1, 2, 3}