<commit_before>describe("The ot object has method which help in inheritance", function () {
    describe("a inherit method", function () {
        var objA, objB;
        objA = {
            p1: true
        };
        objB = ot.inherit(objA, {
            p2: true
        });

        it("which allows you to inherit from an object", function () {
            expect(objB.p1).toBe(true);
            expect(objB.hasOwnProperty("p1")).toBe(false);
        });

        it("which allows you to merge an object to the resulting object", function () {
            expect(objB.p2).toBe(true);
            expect(objB.hasOwnProperty("p2")).toBe(true);
        });
    });

    describe("a deepInherit method", function () {
        var objA, objB;
        objA = {
            p1: true,
            p2: {
                p2_1: true,
                p2_2: {
                    p2_2_1: true
                }
            }
        };
        objB = ot.recursiveInherit(objA, {
            p2: {
                p2_3: true,
                p2_2: {
                    p2_2_2: true
                }
            }
        }, function (obj, superObj, level) {
            obj.level = level;
            if (obj.__proto__) {
                obj.inheritSuper = (obj.__proto__ === superObj);
            } else {
                obj.inheritSuper = true;
                for (var key in superObj) {
                    if (!(key in obj)) {
                        obj.inheritSuper = false;
                    }
                }
            }
        });

        it("which allows you to inherit from an object recursively", function () {
            expect(objB.p1).toBe(true);
            expect(objB.hasOwnProperty("p1")).toBe(false);

            expect(objB.p2.p2_1).toBe(true);
            expect(objB.p2.hasOwnProperty("p2_1")).toBe(false);

            expect(objB.p2.p2_2.p2_2_1).toBe(true);
            expect(objB.p2.p2_2.hasOwnProperty("p2_2_1")).toBe(false);
        });

        it("which allows you to deeply merge an object to the resulting object", function () {
            expect(objB.p2).toBeDefined()
            expect(objB.hasOwnProperty("p2")).toBe(true);

            expect(objB.p2.p2_3).toBe(true);
            expect(objB.p2.hasOwnProperty("p2_3")).toBe(true);

            expect(objB.p2.p2_2.p2_2_2).toBe(true);
            expect(objB.p2.p2_2.hasOwnProperty("p2_2_2")).toBe(true);
        });

        it("which invoke the function you provide it on each level of deep inheritance", function () {
            expect(objB.level).toBe(0);
            expect(objB.p2.level).toBe(1);
            expect(objB.p2.p2_2.level).toBe(2);

            expect(objB.inheritSuper).toBe(true);
            expect(objB.p2.inheritSuper).toBe(true);
            expect(objB.p2.p2_2.inheritSuper).toBe(true);
        });
    });



    describe("a boundInherit method", function () {
        var objA, objB;
        objA = {
            p1: true,
            p2: {
                p2_1: true,
                p2_2: {
                    p2_2_1: true
                }<commit_msg>test(deepInherit): test functions only get deepInherited when necessary<commit_after>describe("The ot object has method which help in inheritance", function () {
    describe("a inherit method", function () {
        var objA, objB;
        objA = {
            p1: true
        };
        objB = ot.inherit(objA, {
            p2: true
        });

        it("which allows you to inherit from an object", function () {
            expect(objB.p1).toBe(true);
            expect(objB.hasOwnProperty("p1")).toBe(false);
        });

        it("which allows you to merge an object to the resulting object", function () {
            expect(objB.p2).toBe(true);
            expect(objB.hasOwnProperty("p2")).toBe(true);
        });
    });

    describe("a deepInherit method", function () {
        var objA, objB;
        objA = {
            p1: true,
            p2: {
                p2_1: true,
                p2_2: {
                    p2_2_1: true
                }
            }
        };
        objB = ot.deepInherit(objA, {
            p2: {
                p2_3: true,
                p2_2: {
                    p2_2_2: true
                }
            }
        }, function (obj, superObj, level) {
            obj.level = level;
            if (obj.__proto__) {
                obj.inheritSuper = (obj.__proto__ === superObj);
            } else {
                obj.inheritSuper = true;
                for (var key in superObj) {
                    if (!(key in obj)) {
                        obj.inheritSuper = false;
                    }
                }
            }
        });

        it("which allows you to inherit from an object recursively", function () {
            expect(objB.p1).toBe(true);
            expect(objB.hasOwnProperty("p1")).toBe(false);

            expect(objB.p2.p2_1).toBe(true);
            expect(objB.p2.hasOwnProperty("p2_1")).toBe(false);

            expect(objB.p2.p2_2.p2_2_1).toBe(true);
            expect(objB.p2.p2_2.hasOwnProperty("p2_2_1")).toBe(false);
        });

        it("which allows you to deeply merge an object to the resulting object", function () {
            expect(objB.p2).toBeDefined()
            expect(objB.hasOwnProperty("p2")).toBe(true);

            expect(objB.p2.p2_3).toBe(true);
            expect(objB.p2.hasOwnProperty("p2_3")).toBe(true);

            expect(objB.p2.p2_2.p2_2_2).toBe(true);
            expect(objB.p2.p2_2.hasOwnProperty("p2_2_2")).toBe(true);
        });

        it("which invoke the function you provide it on each level of deep inheritance", function () {
            expect(objB.level).toBe(0);
            expect(objB.p2.level).toBe(1);
            expect(objB.p2.p2_2.level).toBe(2);

            expect(objB.inheritSuper).toBe(true);
            expect(objB.p2.inheritSuper).toBe(true);
            expect(objB.p2.p2_2.inheritSuper).toBe(true);
        });

        it("which doesn't inherit a function if it doesn't have user defined properties", function () {
            var objA = {
                p1: function(){},
                p2: {
                    p3: function(){}
                }
            };

            var objB = ot.deepInherit(objA);
            expect(objB.hasOwnProperty("p1")).toBe(false);
            expect(objB.p2.hasOwnProperty("p3")).toBe(false);

            objA.p1.prop = true;
            objA.p2.p3.prop = true;

            var objC = ot.deepInherit(objA);
            expect(objC.hasOwnProperty("p1")).toBe(true);
            expect(objC.p2.hasOwnProperty("p3")).toBe(true);
        });
    });



    describe("a boundInherit method", function () {
        var objA, objB;
        objA = {
            p1: true,
            p2: {
                p2_1: true,
                p2_2: {
                    p2_2_1: true
                }
{'fraction_non_alphanumeric': 0.12955700798838055, 'fraction_numerical': 0.025853304284676835, 'mean_word_length': 1.4375221238938054, 'pattern_counts': {'":': 0, '<': 3, '<?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': '2228755', 'n_tokens_mistral': 2154, 'n_tokens_neox': 2089, 'n_words': 379}