コード例 #1
0
def test_nearest_subpackage():
    # degenerate
    assert SetupPy.nearest_subpackage('twitter', []) == 'twitter'
    assert SetupPy.nearest_subpackage('twitter', ['twitter']) == 'twitter'
    assert SetupPy.nearest_subpackage('twitter', ['foursquare']) == 'twitter'

    # common prefix
    assert 'twitter' == SetupPy.nearest_subpackage('twitter.util', ['twitter'])
    assert 'twitter.util' == SetupPy.nearest_subpackage(
        'twitter.util', ['twitter', 'twitter.util'])
    assert 'twitter.util' == SetupPy.nearest_subpackage(
        'twitter.util.topo', ['twitter', 'twitter.util'])
    assert 'twitter' == SetupPy.nearest_subpackage('twitter.utilization',
                                                   ['twitter', 'twitter.util'])
コード例 #2
0
ファイル: test_setup_py.py プロジェクト: CodeWarltz/commons
def test_nearest_subpackage():
  # degenerate
  assert SetupPy.nearest_subpackage('twitter', []) == 'twitter'
  assert SetupPy.nearest_subpackage('twitter', ['twitter']) == 'twitter'
  assert SetupPy.nearest_subpackage('twitter', ['foursquare']) == 'twitter'

  # common prefix
  assert 'twitter' == SetupPy.nearest_subpackage('twitter.util', ['twitter'])
  assert 'twitter.util' == SetupPy.nearest_subpackage(
      'twitter.util', ['twitter', 'twitter.util'])
  assert 'twitter.util' == SetupPy.nearest_subpackage(
      'twitter.util.topo', ['twitter', 'twitter.util'])
  assert 'twitter' == SetupPy.nearest_subpackage(
      'twitter.utilization', ['twitter', 'twitter.util'])