Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_reserved():
assert not PureS3Path('/a/b').is_reserved()
assert not PureS3Path('a/b').is_reserved()
def test_repr():
assert repr(PureS3Path('setup.py')) == "PureS3Path('setup.py')"
assert str(PureS3Path('setup.py')) == 'setup.py'
assert bytes(PureS3Path('setup.py')) == b'setup.py'
assert PureS3Path('/usr/bin').as_posix() == '/usr/bin'
def test_parent():
assert PureS3Path('foo//bar').parent == PureS3Path('foo')
assert PureS3Path('foo/./bar').parent == PureS3Path('foo')
assert PureS3Path('foo/../bar').parent == PureS3Path('.')
assert PureS3Path('../bar').parent == PureS3Path('..')
assert PureS3Path('foo', '../bar').parent == PureS3Path('.')
assert PureS3Path('/foo/bar').parent == PureS3Path('/foo')
assert PureS3Path('.').parent == PureS3Path('.')
assert PureS3Path('/').parent == PureS3Path('/')
def test_join_strs():
assert PureS3Path('foo', 'some/path', 'bar') == PureS3Path('foo/some/path/bar')
def test_parts():
assert PureS3Path('foo//bar').parts == ('foo', 'bar')
assert PureS3Path('foo/./bar').parts == ('foo', 'bar')
assert PureS3Path('foo/../bar').parts == ('bar',)
assert PureS3Path('../bar').parts == ('..', 'bar')
assert PureS3Path('foo', '../bar').parts == ('bar',)
assert PureS3Path('/foo/bar').parts == ('/', 'foo', 'bar')
def test_match():
assert PureS3Path('a/b.py').match('*.py')
assert PureS3Path('/a/b/c.py').match('b/*.py')
assert not PureS3Path('/a/b/c.py').match('a/*.py')
assert PureS3Path('/a.py').match('/*.py')
assert not PureS3Path('a/b.py').match('/*.py')
assert not PureS3Path('a/b.py').match('*.Py')
def test_absolute():
assert PureS3Path('/a/b').is_absolute()
assert not PureS3Path('a/b').is_absolute()
def test_parent():
assert PureS3Path('foo//bar').parent == PureS3Path('foo')
assert PureS3Path('foo/./bar').parent == PureS3Path('foo')
assert PureS3Path('foo/../bar').parent == PureS3Path('.')
assert PureS3Path('../bar').parent == PureS3Path('..')
assert PureS3Path('foo', '../bar').parent == PureS3Path('.')
assert PureS3Path('/foo/bar').parent == PureS3Path('/foo')
assert PureS3Path('.').parent == PureS3Path('.')
assert PureS3Path('/').parent == PureS3Path('/')
def test_root():
assert PureS3Path('foo//bar').root == ''
assert PureS3Path('foo/./bar').root == ''
assert PureS3Path('foo/../bar').root == ''
assert PureS3Path('../bar').root == ''
assert PureS3Path('foo', '../bar').root == ''
assert PureS3Path('/foo/bar').root == '/'