mirror of
				https://github.com/graphql-python/graphene.git
				synced 2025-10-31 16:07:27 +03:00 
			
		
		
		
	fix assertion for badly formed JSON input on Python 3.13
This commit is contained in:
		
							parent
							
								
									393ff70701
								
							
						
					
					
						commit
						bc35e7f94e
					
				|  | @ -51,35 +51,30 @@ def test_jsonstring_invalid_query(): | ||||||
|     Test that if an invalid type is provided we get an error |     Test that if an invalid type is provided we get an error | ||||||
|     """ |     """ | ||||||
|     result = schema.execute("{ json(input: 1) }") |     result = schema.execute("{ json(input: 1) }") | ||||||
|     assert result.errors |     assert result.errors == [ | ||||||
|     assert len(result.errors) == 1 |         {"message": "Expected value of type 'JSONString', found 1."}, | ||||||
|     assert result.errors[0].message == "Expected value of type 'JSONString', found 1." |     ] | ||||||
| 
 | 
 | ||||||
|     result = schema.execute("{ json(input: {}) }") |     result = schema.execute("{ json(input: {}) }") | ||||||
|     assert result.errors |     assert result.errors == [ | ||||||
|     assert len(result.errors) == 1 |         {"message": "Expected value of type 'JSONString', found {}."}, | ||||||
|     assert result.errors[0].message == "Expected value of type 'JSONString', found {}." |     ] | ||||||
| 
 | 
 | ||||||
|     result = schema.execute('{ json(input: "a") }') |     result = schema.execute('{ json(input: "a") }') | ||||||
|     assert result.errors |     assert result.errors == [ | ||||||
|     assert len(result.errors) == 1 |         { | ||||||
|     assert result.errors[0].message == ( |             "message": "Expected value of type 'JSONString', found \"a\"; " | ||||||
|         "Expected value of type 'JSONString', found \"a\"; " |             "Badly formed JSONString: Expecting value: line 1 column 1 (char 0)", | ||||||
|         "Badly formed JSONString: Expecting value: line 1 column 1 (char 0)" |         }, | ||||||
|     ) |     ] | ||||||
| 
 | 
 | ||||||
|     result = schema.execute("""{ json(input: "{\\'key\\': 0}") }""") |     result = schema.execute("""{ json(input: "{\\'key\\': 0}") }""") | ||||||
|     assert result.errors |     assert result.errors == [ | ||||||
|     assert len(result.errors) == 1 |         {"message": "Syntax Error: Invalid character escape sequence: '\\''."}, | ||||||
|     assert ( |     ] | ||||||
|         result.errors[0].message |  | ||||||
|         == "Syntax Error: Invalid character escape sequence: '\\''." |  | ||||||
|     ) |  | ||||||
| 
 | 
 | ||||||
|     result = schema.execute("""{ json(input: "{\\"key\\": 0,}") }""") |     result = schema.execute("""{ json(input: "{\\"key\\": 0,}") }""") | ||||||
|     assert result.errors |  | ||||||
|     assert len(result.errors) == 1 |     assert len(result.errors) == 1 | ||||||
|     assert result.errors[0].message == ( |     assert result.errors[0].message.startswith( | ||||||
|         'Expected value of type \'JSONString\', found "{\\"key\\": 0,}"; ' |         'Expected value of type \'JSONString\', found "{\\"key\\": 0,}"; Badly formed JSONString:' | ||||||
|         "Badly formed JSONString: Expecting property name enclosed in double quotes: line 1 column 11 (char 10)" |  | ||||||
|     ) |     ) | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user