<commit_before>package graphql

import graphql.language.BooleanValue
import graphql.language.FloatValue
import graphql.language.IntValue
import graphql.language.StringValue
import spock.lang.Specification


class ScalarsTest extends Specification {

    def "String parse literal"() {
        expect:
        Scalars.GraphQLString.getCoercing().parseLiteral(literal) == result

        where:
        literal                 | result
        new StringValue("test") | "test"
    }

    def "String serialize/parseValue object"() {
        expect:
        Scalars.GraphQLString.getCoercing().serialize(value) == result
        Scalars.GraphQLString.getCoercing().parseValue(value) == result

        where:
        value         | result
        Boolean.FALSE | "false"
        "test"        | "test"
    }


    def "ID parse literal"() {
        expect:
        Scalars.GraphQLID.getCoercing().parseLiteral(literal) == result

        where:
        literal                               | result
        new StringValue("5457486ABSBHS4w646") | "5457486ABSBHS4w646"
    }

    def "ID serialize/parseValue object"() {
        expect:
        Scalars.GraphQLID.getCoercing().serialize(value) == result
        Scalars.GraphQLID.getCoercing().parseValue(value) == result

        where:
        value                | result
        "5457486ABSBHS4w646" | "5457486ABSBHS4w646"

    }

    def "Long parse literal"() {
        expect:
        Scalars.GraphQLLong.getCoercing().parseLiteral(literal) == result

        where:
        literal               | result
        new StringValue("42") | 42
        new IntValue(42)      | 42
    }


    def "Long serialize/parseValue object"() {
        expect:
        Scalars.GraphQLLong.getCoercing().serialize(value) == result
        Scalars.GraphQLLong.getCoercing().parseValue(value) == result

        where:
        value                        | result
        "42"                         | 42
        new Long(42345784398534785l) | 42345784398534785l
        new Integer(42)              | 42
    }


    def "Int parse literal"() {
        expect:
        Scalars.GraphQLInt.getCoercing().parseLiteral(literal) == result

        where:
        literal          | result
        new IntValue(42) | 42

    }

    def "Int serialize/parseValue object"() {
        expect:
        Scalars.GraphQLInt.getCoercing().serialize(value) == result
        Scalars.GraphQLInt.getCoercing().parseValue(value) == result

        where:
        value           | result
        "42"            | 42
        new Integer(42) | 42
    }

    def "Float parse literal"() {
        expect:
        Scalars.GraphQLFloat.getCoercing().parseLiteral(literal) == result

        where:
        literal              | result
        new FloatValue(42.3) | 42.3f
    }

    def "Float serialize/parseValue object"() {
        expect:
        Scalars.GraphQLFloat.getCoercing().serialize(value) == result
        Scalars.GraphQLFloat.getCoercing().parseValue(value) == result

        where:
        value           | result
        "42.3"          | 42.3f
        "42.0"          | 42.0f
        new Float(42.3) | 42.3f
    }

    def "Boolean parse literal"() {
        expect:
        Scalars.GraphQLBoolean.getCoercing().parseLiteral(literal) == result

        where:
        literal                | result
        new BooleanValue(true) | true
    }

    def "Boolean serialize/parseValue object"() {
        expect:
        Scalars.GraphQLBoolean.getCoercing().serialize(value) == result
        Scalars.GraphQLBoolean.getCoercing().parseValue(value) == result

        where:
        value   | result
        true    | true
        "false" | false
        "true"  | true
        0       | false
        1       | true
    }


}
<commit_msg>test for string null input<commit_after>package graphql

import graphql.language.BooleanValue
import graphql.language.FloatValue
import graphql.language.IntValue
import graphql.language.StringValue
import spock.lang.Specification


class ScalarsTest extends Specification {

    def "String parse literal"() {
        expect:
        Scalars.GraphQLString.getCoercing().parseLiteral(literal) == result

        where:
        literal                 | result
        new StringValue("test") | "test"
    }

    def "String serialize/parseValue object"() {
        expect:
        Scalars.GraphQLString.getCoercing().serialize(value) == result
        Scalars.GraphQLString.getCoercing().parseValue(value) == result

        where:
        value         | result
        Boolean.FALSE | "false"
        "test"        | "test"
        null| null
    }


    def "ID parse literal"() {
        expect:
        Scalars.GraphQLID.getCoercing().parseLiteral(literal) == result

        where:
        literal                               | result
        new StringValue("5457486ABSBHS4w646") | "5457486ABSBHS4w646"
    }

    def "ID serialize/parseValue object"() {
        expect:
        Scalars.GraphQLID.getCoercing().serialize(value) == result
        Scalars.GraphQLID.getCoercing().parseValue(value) == result

        where:
        value                | result
        "5457486ABSBHS4w646" | "5457486ABSBHS4w646"

    }

    def "Long parse literal"() {
        expect:
        Scalars.GraphQLLong.getCoercing().parseLiteral(literal) == result

        where:
        literal               | result
        new StringValue("42") | 42
        new IntValue(42)      | 42
    }


    def "Long serialize/parseValue object"() {
        expect:
        Scalars.GraphQLLong.getCoercing().serialize(value) == result
        Scalars.GraphQLLong.getCoercing().parseValue(value) == result

        where:
        value                        | result
        "42"                         | 42
        new Long(42345784398534785l) | 42345784398534785l
        new Integer(42)              | 42
    }


    def "Int parse literal"() {
        expect:
        Scalars.GraphQLInt.getCoercing().parseLiteral(literal) == result

        where:
        literal          | result
        new IntValue(42) | 42

    }

    def "Int serialize/parseValue object"() {
        expect:
        Scalars.GraphQLInt.getCoercing().serialize(value) == result
        Scalars.GraphQLInt.getCoercing().parseValue(value) == result

        where:
        value           | result
        "42"            | 42
        new Integer(42) | 42
    }

    def "Float parse literal"() {
        expect:
        Scalars.GraphQLFloat.getCoercing().parseLiteral(literal) == result

        where:
        literal              | result
        new FloatValue(42.3) | 42.3f
    }

    def "Float serialize/parseValue object"() {
        expect:
        Scalars.GraphQLFloat.getCoercing().serialize(value) == result
        Scalars.GraphQLFloat.getCoercing().parseValue(value) == result

        where:
        value           | result
        "42.3"          | 42.3f
        "42.0"          | 42.0f
        new Float(42.3) | 42.3f
    }

    def "Boolean parse literal"() {
        expect:
        Scalars.GraphQLBoolean.getCoercing().parseLiteral(literal) == result

        where:
        literal                | result
        new BooleanValue(true) | true
    }

    def "Boolean serialize/parseValue object"() {
        expect:
        Scalars.GraphQLBoolean.getCoercing().serialize(value) == result
        Scalars.GraphQLBoolean.getCoercing().parseValue(value) == result

        where:
        value   | result
        true    | true
        "false" | false
        "true"  | true
        0       | false
        1       | true
    }


}

{'fraction_non_alphanumeric': 0.0995254416029528, 'fraction_numerical': 0.03480094911679409, 'mean_word_length': 1.757906215921483, '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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3737189', 'n_tokens_mistral': 2368, 'n_tokens_neox': 2141, 'n_words': 416}