def test_read(tmpdir):
    # no special files in arguments, expect what's been passed in
    assert None is scripts.read(None)
    assert 'foo' == scripts.read('foo')
    assert (1,) == scripts.read((1,))

    # same but with split
    assert None is scripts.read(None, split=True)
    assert ['foo'] == scripts.read('foo', split=True)
    assert (1,) == scripts.read((1,), split=True)

    # stdin specifiers
    with stdin('text'):
        assert 'text' == scripts.read('-')
    with stdin('text'):
        assert 'text' == scripts.read('@-')

    # explicit file specifier
    infile = tmpdir.join('infile')
    infile.write('farb')
    assert 'farb' == scripts.read('@%s' % infile)

    # implied file
    assert 'farb' == scripts.read('%s' % infile)

    # failed explict file
    try:
        noexist = 'not-here-hopefully'
        scripts.read('@%s' % noexist)
        assert False
    except ClickException as ex:
        assert str(ex) == noexist % "[Errno 2] No such file or directory: '%s'"

    # splitting
    xs = scripts.read(' x\nx\r\nx\t\tx\t\n x ', split=True)
    assert ['x'] * 5 == xs
dataset/ETHPy150Open planetlabs/planet-client-python/tests/test_cli.py/test_read/swapped operands of `%`