Пример #1
0
def test_create_graph_link_redirected_twice(tmp_path):
    path = tmp_path / "rediraffe.txt"
    path.write_text("""
        a b
        a c
        """)
    with pytest.raises(ExtensionError):
        graph = create_graph(path)
Пример #2
0
 def test_both_single_quotes(self, tmp_path):
     path = tmp_path / "rediraffe.txt"
     path.write_text("""
         'a' 'b'
         'c' 'd'
         d e
         """)
     graph = create_graph(path)
     assert graph == {
         "a": "b",
         "c": "d",
         "d": "e",
     }
Пример #3
0
 def test_no_quotes(self, tmp_path):
     path = tmp_path / "rediraffe.txt"
     path.write_text("""
         a b
         c d
         d e
         """)
     graph = create_graph(path)
     assert graph == {
         "a": "b",
         "c": "d",
         "d": "e",
     }
Пример #4
0
def test_create_graph_spacing(tmp_path):
    path = tmp_path / "rediraffe.txt"
    path.write_text("""
        a  b
        c d
        d            e
        """)
    graph = create_graph(path)
    assert graph == {
        "a": "b",
        "c": "d",
        "d": "e",
    }
Пример #5
0
 def test_both_double_quotes(self, tmp_path):
     path = tmp_path / "rediraffe.txt"
     path.write_text("""
         "a" "b"
         "c" "d"
         d e
         """)
     graph = create_graph(path)
     assert graph == {
         "a": "b",
         "c": "d",
         "d": "e",
     }
Пример #6
0
 def test_quote_in_path(self, tmp_path):
     path = tmp_path / "rediraffe.txt"
     path.write_text("""
         "a b
         c d'
         d "e
         "e' f'"
         """)
     graph = create_graph(path)
     assert graph == {
         '"a': "b",
         "c": "d'",
         "d": '"e',
         "\"e'": "f'\"",
     }
Пример #7
0
 def test_commented(self, tmp_path):
     path = tmp_path / "rediraffe.txt"
     path.write_text("""
         # a comment
         a b
         c d
         # another comment
         d e
         """)
     graph = create_graph(path)
     assert graph == {
         "a": "b",
         "c": "d",
         "d": "e",
     }
Пример #8
0
 def test_complex(self, tmp_path):
     path = tmp_path / "rediraffe.txt"
     path.write_text("""
         "Double Quoted Path" 'Single Quoted Path'
         "Website's Contents" "other"
         'Store's Contents' other
         "quoteskept' "other"
         ""I'm ready! I'm ready!" - Spongebob Squarepants.rst" "just why?.rst"
         """)
     graph = create_graph(path)
     assert graph == {
         "Double Quoted Path":
         "Single Quoted Path",
         "Website's Contents":
         "other",
         "Store's Contents":
         "other",
         "\"quoteskept'":
         "other",
         "\"I'm ready! I'm ready!\" - Spongebob Squarepants.rst":
         "just why?.rst",
     }