[ https://issues.apache.org/jira/browse/TINKERPOP-2234?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18022845#comment-18022845 ]
ASF GitHub Bot commented on TINKERPOP-2234: ------------------------------------------- xiazcy commented on code in PR #3211: URL: https://github.com/apache/tinkerpop/pull/3211#discussion_r2379719319 ########## gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/test/features/map/AsNumber.feature: ########## @@ -103,196 +103,206 @@ Feature: Step - asNumber() | d[5.75].f | @GraphComputerVerificationInjectionNotSupported - Scenario: g_injectX5_43X_asNumberXN_intX + Scenario: g_injectX5X_asNumber Given the empty graph And the traversal of """ - g.inject(5.43).asNumber(N.int) + g.inject("5").asNumber() """ When iterated to list Then the result should be unordered | result | | d[5].i | @GraphComputerVerificationInjectionNotSupported - Scenario: g_injectX5_67X_asNumberXN_intX + Scenario: g_injectXtestX_asNumber Given the empty graph And the traversal of """ - g.inject(5.67).asNumber(N.int) + g.inject("test").asNumber() """ When iterated to list - Then the result should be unordered - | result | - | d[5].i | + Then the traversal will raise an error with message containing text of "Can't parse string 'test' as number." @GraphComputerVerificationInjectionNotSupported - Scenario: g_injectX5X_asNumberXN_longX + Scenario: g_injectX_1_2_3_4X_asNumber Given the empty graph And the traversal of """ - g.inject(5).asNumber(N.long) + g.inject([1, 2, 3, 4]).asNumber() + """ + When iterated to list + Then the traversal will raise an error with message containing text of "Can't parse type ArrayList as number." + + @GraphComputerVerificationInjectionNotSupported + Scenario: g_injectX1_2_3_4X_unfold_asNumber + Given the empty graph + And the traversal of + """ + g.inject([1, 2, 3, 4]).unfold().asNumber() """ When iterated to list Then the result should be unordered | result | - | d[5].l | + | d[1].i | + | d[2].i | + | d[3].i | + | d[4].i | @GraphComputerVerificationInjectionNotSupported - Scenario: g_injectX12X_asNumberXN_byteX + Scenario: g_injectX_1__2__3__4_X_asNumberXX_foldXX Given the empty graph And the traversal of """ - g.inject(12).asNumber(N.byte) + g.inject("1", 2, "3", 4).asNumber().fold() """ When iterated to list Then the result should be unordered | result | - | d[12].b | + | l[d[1].i,d[2].i,d[3].i,d[4].i] | @GraphComputerVerificationInjectionNotSupported - Scenario: g_injectX32768X_asNumberXN_shortX + Scenario: g_injectX5_43X_asNumberXGType_INTX Given the empty graph And the traversal of """ - g.inject(32768).asNumber(N.short) + g.inject(5.43).asNumber(GType.INT) """ When iterated to list - Then the traversal will raise an error with message containing text of "Can't convert number of type Integer to Short due to overflow." + Then the result should be unordered + | result | + | d[5].i | @GraphComputerVerificationInjectionNotSupported - Scenario: g_injectX300X_asNumberXN_byteX + Scenario: g_injectX5_67X_asNumberXGType_INTX Given the empty graph And the traversal of """ - g.inject(300).asNumber(N.byte) + g.inject(5.67).asNumber(GType.INT) """ When iterated to list - Then the traversal will raise an error with message containing text of "Can't convert number of type Integer to Byte due to overflow." + Then the result should be unordered + | result | + | d[5].i | @GraphComputerVerificationInjectionNotSupported - Scenario: g_injectX5X_asNumber + Scenario: g_injectX5X_asNumberXGType_LONGX Given the empty graph And the traversal of """ - g.inject("5").asNumber() + g.inject(5).asNumber(GType.LONG) """ When iterated to list Then the result should be unordered | result | - | d[5].i | + | d[5].l | @GraphComputerVerificationInjectionNotSupported - Scenario: g_injectX5X_asNumberXN_byteX + Scenario: g_injectX12X_asNumberXGType_BYTEX Given the empty graph And the traversal of """ - g.inject("5").asNumber(N.byte) + g.inject(12).asNumber(GType.BYTE) """ When iterated to list Then the result should be unordered | result | - | d[5].b | + | d[12].b | @GraphComputerVerificationInjectionNotSupported - Scenario: g_injectX1_000X_asNumberXN_bigIntX + Scenario: g_injectX32768X_asNumberXGType_SHORTX Given the empty graph And the traversal of """ - g.inject("1,000").asNumber(N.bigInt) + g.inject(32768).asNumber(GType.SHORT) """ When iterated to list - Then the traversal will raise an error with message containing text of "Can't parse string '1,000' as number." + Then the traversal will raise an error with message containing text of "Can't convert number of type Integer to Short due to overflow." @GraphComputerVerificationInjectionNotSupported - Scenario: g_injectXtestX_asNumber + Scenario: g_injectX300X_asNumberXGType_BYTEX Given the empty graph And the traversal of """ - g.inject("test").asNumber() + g.inject(300).asNumber(GType.BYTE) """ When iterated to list - Then the traversal will raise an error with message containing text of "Can't parse string 'test' as number." + Then the traversal will raise an error with message containing text of "Can't convert number of type Integer to Byte due to overflow." @GraphComputerVerificationInjectionNotSupported Review Comment: I think the main reason is we used a lot of `inject()` cases cause they are the easiest, I'll add some non-inject ones. > Introduce Type Predicate > ------------------------ > > Key: TINKERPOP-2234 > URL: https://issues.apache.org/jira/browse/TINKERPOP-2234 > Project: TinkerPop > Issue Type: Improvement > Components: process > Affects Versions: 3.4.2 > Reporter: Stephen Mallette > Priority: Major > > Provide for a {{typeOf()}} predicate that allows for testing the type of an > object which would enable neat things like: > {code} > g.V().outE().has('weight',gt(0.1)).inV().path().unfold().is(typeOf(VERTEX)) > {code} > See the linked DISCUSS thread for more information. -- This message was sent by Atlassian Jira (v8.20.10#820010)