def test_comments():
    code = """
    # cm0
    class Foo:
        # cm1
        def foo(self):
            # cm2
            if 1:
                # cm3
                a = 3
            else:
                # cm4
                a = 2
            for i in x:
                # cm5
                a += i
            else:
                # cm6
                pass
            while x:
                # cm7
                pass
            else:
                # cm8
                pass
            try:
                # cm9
                pass
            except Exception:
                # cm10
                pass
            else:
                # cm10
                pass
            finally:
                # cm11
                pass
            with foo:
               # cm12
               bar
    """
    code = '\n'.join(x[4:] for x in code.splitlines())
    
    root = commonast.parse(code, comments=False)
    assert 'cm' not in root.tojson()
    
    root = commonast.parse(code, comments=True)
    for i in range(13):
        assert root.tojson() in ('cm%i' % i)
dataset/ETHPy150Open zoofIO/flexx/flexx/pyscript/tests/test_commonast.py/test_comments/swapped operands of `in`