<commit_before>import pytest

class TestClassObject(object):
    def test_name(self, space):
        space.execute("Class")

    def test_to_s(self, space):
        w_res = space.execute("return 1.class.to_s")
        assert space.str_w(w_res) == "Fixnum"

        w_res = space.execute("return 1.class.class.to_s")
        assert space.str_w(w_res) == "Class"

    def test_anon_class_to_s(self, space):
        w_res = space.execute("return Class.new.to_s")
        assert space.str_w(w_res).startswith("#<Class:0x")

        w_res = space.execute("return Class.new.new.to_s")
        assert space.str_w(w_res).startswith("#<#<Class:0x")

    @pytest.mark.xfail
    def test_singletonclass_to_s(self, space):
        w_res = space.execute("Class.new.singleton_class.to_s")
        assert space.str_w(w_res).startswith("#<Class:#<Class:0x")

    def test_anon_class_name(self, space):
        w_res = space.execute("return Class.new.name")
        assert w_res is space.w_nil

    def test_singletonclass_name(self, space):
        w_res = space.execute("Class.new.singleton_class.name")
        assert w_res is space.w_nil

    def test_class_new(self, space):
        w_res = space.execute("return Class.new.superclass.name")
        assert space.str_w(w_res) == "Object"
        w_res = space.execute("return Class.new(String).superclass.name")
        assert space.str_w(w_res) == "String"

    def test_new(self, space):
        w_res = space.execute("""
        class X
        end

        return X.new<commit_msg>test anonymous class method_missing behavior<commit_after>import pytest
from ..base import BaseTopazTest


class TestClassObject(BaseTopazTest):
    def test_name(self, space):
        space.execute("Class")

    def test_to_s(self, space):
        w_res = space.execute("return 1.class.to_s")
        assert space.str_w(w_res) == "Fixnum"

        w_res = space.execute("return 1.class.class.to_s")
        assert space.str_w(w_res) == "Class"

    def test_anon_class_to_s(self, space):
        w_res = space.execute("return Class.new.to_s")
        assert space.str_w(w_res).startswith("#<Class:0x")

        w_res = space.execute("return Class.new.new.to_s")
        assert space.str_w(w_res).startswith("#<#<Class:0x")

    @pytest.mark.xfail
    def test_singletonclass_to_s(self, space):
        w_res = space.execute("Class.new.singleton_class.to_s")
        assert space.str_w(w_res).startswith("#<Class:#<Class:0x")

    def test_anon_class_name(self, space):
        w_res = space.execute("return Class.new.name")
        assert w_res is space.w_nil

    def test_anon_class_method_missing_raises(self, space):
        with self.raises(space, "NoMethodError"):
            space.execute("""
            class A; end
            Class.new.does_not_exist
            """)

    def test_singletonclass_name(self, space):
        w_res = space.execute("Class.new.singleton_class.name")
        assert w_res is space.w_nil

    def test_class_new(self, space):
        w_res = space.execute("return Class.new.superclass.name")
        assert space.str_w(w_res) == "Object"
        w_res = space.execute("return Class.new(String).superclass.name")
        assert space.str_w(w_res) == "String"

    def test_new(self, space):
        w_res = space.execute("""
        class X
        end

        return X.new
{'fraction_non_alphanumeric': 0.12799760191846524, 'fraction_numerical': 0.002997601918465228, 'mean_word_length': 2.9120750293083235, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3932254', 'n_tokens_mistral': 1158, 'n_tokens_neox': 1134, 'n_words': 194}