File: test_scope_parser.py

package info (click to toggle)
python-globus-sdk 4.3.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,172 kB
  • sloc: python: 35,227; sh: 44; makefile: 35
file content (32 lines) | stat: -rw-r--r-- 794 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import pytest

from globus_sdk.scopes import ScopeParser


def _make_deep_scope(depth):
    big_scope = ""
    for i in range(depth):
        big_scope += f"foo{i}["
    big_scope += "bar"
    for _ in range(depth):
        big_scope += "]"
    return big_scope


def _make_wide_scope(width):
    big_scope = ""
    for i in range(width):
        big_scope += f"foo{i} "
    return big_scope


@pytest.mark.parametrize("depth", (10, 100, 1000, 2000, 3000, 4000, 5000))
def test_deep_scope_parsing(benchmark, depth):
    scope_string = _make_deep_scope(depth)
    benchmark(ScopeParser.parse, scope_string)


@pytest.mark.parametrize("width", (5000, 10000))
def test_wide_scope_parsing(benchmark, width):
    scope_string = _make_wide_scope(width)
    benchmark(ScopeParser.parse, scope_string)