Beispiel #1
0
def test_find_imports():

    res = find_imports(
        dedent("""
           import numpy as np
           from scipy import sparse
           import matplotlib.pyplot as plt
           """))
    assert set(res) == {"numpy", "scipy", "matplotlib"}
Beispiel #2
0
def test_find_imports():

    res = find_imports("""
        import numpy as np
        from scipy import sparse
        import matplotlib.pyplot as plt
        """)
    assert set(res) == {"numpy", "scipy", "matplotlib"}

    # If there is a syntax error in the code, find_imports should return empty
    # list.
    res = find_imports("""
        import numpy as np
        from scipy import sparse
        import matplotlib.pyplot as plt
        for x in [1,2,3]
        """)
    assert res == []
Beispiel #3
0
def test_find_imports():

    res = find_imports(
        dedent("""
           import six
           import numpy as np
           from scipy import sparse
           import matplotlib.pyplot as plt
           """))
    assert set(res) == {'numpy', 'scipy', 'six', 'matplotlib'}