Example #1
0
def test_cp23545():
    import clr
    clr.AddReference("rowantest.defaultmemberscs")
    from Merlin.Testing.DefaultMemberSample import ClassWithDefaultField
    AreEqual(repr(ClassWithDefaultField.Field),
             "<field# Field on ClassWithDefaultField>")
    try:
        ClassWithDefaultField.Field = 20
    except ValueError as e:
        AreEqual(e.message, "assignment to instance field w/o instance")
    AreEqual(ClassWithDefaultField().Field, 10)
        self.assertEqual(self.cp22692_helper("if 1:\n  if 1:", 0),
                         [IndentationError, IndentationError])

    @skipUnlessIronPython()
    def test_cp23545(self):
        import clr
        clr.AddReference("rowantest.defaultmemberscs")
        from Merlin.Testing.DefaultMemberSample import ClassWithDefaultField
        self.assertEqual(repr(ClassWithDefaultField.Field),
                         "<field# Field on ClassWithDefaultField>")
        try:
            ClassWithDefaultField.Field = 20
        except ValueError, e:
            self.assertEqual(e.message,
                             "assignment to instance field w/o instance")
        self.assertEqual(ClassWithDefaultField().Field, 10)

    def test_cp20174(self):
        old_path = [x for x in sys.path]

        sys.path.append(self.test_dir)
        cp20174_path = os.path.join(self.test_dir, "cp20174")

        try:
            cp20174_init = os.path.join(cp20174_path, "__init__.py")
            self.write_to_file(cp20174_init, "import a")

            cp20174_a = os.path.join(cp20174_path, "a.py")
            self.write_to_file(
                cp20174_a, """
from property import x
Example #3
0
    AreEqual(cp22692_helper("if 1:\n  if 1:", 0),
             [IndentationError, IndentationError])


@skip("win32")
def test_cp23545():
    import clr
    clr.AddReference("rowantest.defaultmemberscs")
    from Merlin.Testing.DefaultMemberSample import ClassWithDefaultField
    AreEqual(repr(ClassWithDefaultField.Field),
             "<field# Field on ClassWithDefaultField>")
    try:
        ClassWithDefaultField.Field = 20
    except ValueError, e:
        AreEqual(e.message, "assignment to instance field w/o instance")
    AreEqual(ClassWithDefaultField().Field, 10)


def test_cp20174():
    old_path = [x for x in sys.path]

    sys.path.append(testpath.public_testdir)
    cp20174_path = path_combine(testpath.public_testdir, "cp20174")

    try:
        cp20174_init = path_combine(cp20174_path, "__init__.py")
        write_to_file(cp20174_init, "import a")

        cp20174_a = path_combine(cp20174_path, "a.py")
        write_to_file(
            cp20174_a, """