from scell.core import select, Monitored


def test_select(handles):
    assert select([], []) == ([], [])
    assert select(handles, []) == (handles, [])
    assert select(handles, handles) == (handles, handles)


def test_monitored(handles, mode):
    for monitor in [Monitored(fp, mode) for fp in handles]:
        assert monitor.mode == mode
        assert not monitor.callback()

        assert not monitor.ready

        monitor.readable = True
        monitor.writable = True

        assert monitor.ready

@@ -1,8 +1,60 @@
+from itertools import chain%0Afrom pytest import mark%0A
 from sce
@@ -434,41 +434,373 @@
 ()%0A%0A
-        assert not monitor.ready%0A
+%0A@mark.parametrize(%0A    'fmode,attrs',%0A    chain(%0A        %5Bmark.xfail(('rw', m)) for m in %5B(0,1), (1,0), (0,0)%5D%5D,%0A        %5B('w', m) for m in %5B(0,1), (1,1)%5D%5D,%0A        %5B('r', m) for m in %5B(1,0), (1,1)%5D%5D,%0A        %5B('rw', (1,1))%5D,%0A    )%0A)%0Adef test_monitored_ready(handles, fmode, attrs):%0A    for monitor in %5BMonitored(fp, fmode) for fp in handles%5D:%0A        r, w = attrs
 %0A   
@@ -823,20 +823,17 @@
 dable = 
-True
+r
 %0A       
@@ -856,12 +856,9 @@
 e = 
-True
+w
 %0A%0A  
@@ -884,8 +884,45 @@
 r.ready%0A
+        assert monitor.mode == fmode%0A

test out all possibilities for Monitored.ready