Kirill Simonov avatar Kirill Simonov committed 15d0f06

Reviewing functions.

Added tests for literal values.
Abandoned (poor) support for inf/nan values.
SQLite: fixed DATE serialization; coerce decimal to float.

Comments (0)

Files changed (9)

src/htsql/domain.py

     Represents an IEEE 754 float data type.
 
     Valid literal values: floating-point numbers in decimal or scientific
-    format, `[+-]inf`, or `nan`.
+    format.
 
     Valid native values: `float` objects.
 
         if data is None:
             return None
         # Parse the numeric value.
-        # FIXME: `float('inf')` and `float('nan')` breaks under Python 2.5.
         try:
             value = float(data)
-        except ValueError, exc:
-            raise ValueError("invalid float literal: %s" % exc)
+        except ValueError:
+            raise ValueError("invalid float literal: %s" % data)
+        # Check if we got a finite number.
+        # FIXME: the check may break under Python 2.5; also, in Python 2.6
+        # could use `math.isinf()` and `math.isnan()`.
+        if str(value) in ['inf', '-inf', 'nan']:
+            raise ValueError("invalid float literal: %s" % value)
         return value
 
     def dump(self, value):
     Represents an exact decimal data type.
 
     Valid literal values: floating-point numbers in decimal or scientific
-    format, `[+-]inf`, or `nan`.
+    format.
 
     Valid native values: `decimal.Decimal` objects.
 
         # Parse the literal (NB: it handles `inf` and `nan` values too).
         try:
             value = decimal.Decimal(data)
-        except decimal.InvalidOperation, exc:
-            raise ValueError("invalid decimal literal: %s" % exc)
+        except decimal.InvalidOperation:
+            raise ValueError("invalid decimal literal: %s" % data)
+        # Verify that we got a finite number.
+        if not value.is_finite():
+            raise ValueError("invalid decimal literal: %s" % data)
         return value
 
     def dump(self, value):

src/htsql/tr/dump.py

         # to support a different range of floating-point values or to
         # provide an exact type specifier.
 
-        # Filter out special non-numeric values.
-        # FIXME: this check is only valid under Python 2.6.
-        # Also, in Python 2.6, could use `math.isinf()` and `math.isnan()`.
-        if str(self.value) in ['inf', '-inf', 'nan']:
-            raise SerializeError("invalid float value",
-                                 self.phrase.mark)
+        # Last check that we didn't get a non-number.
+        # FIXME: Python 2.5/win32?
+        assert str(self.value) not in ['inf', '-inf', 'nan']
         # Write the standard representation of the number assuming that
         # the database could figure out its type from the context.
         self.write(repr(self.value))
         # to support a different range of values or to add an exact
         # type specifier.
 
-        # Filter out special non-numeric values.
-        if not self.value.is_finite():
-            raise SerializeError("invalid decimal value",
-                                 self.phrase.mark)
+        # Last check that we didn't get a non-number.
+        assert self.value.is_finite()
         # Write the standard representation of the number assuming that
         # the database could figure out its type from the context.
         self.write(str(self.value))

src/htsql_sqlite/export.py

 import htsql_sqlite.connect
 import htsql_sqlite.split_sql
 import htsql_sqlite.introspect
+import htsql_sqlite.tr.coerce
 import htsql_sqlite.tr.bind
 import htsql_sqlite.tr.dump
 

src/htsql_sqlite/tr/coerce.py

+#
+# Copyright (c) 2006-2010, Prometheus Research, LLC
+# Authors: Clark C. Evans <cce@clarkevans.com>,
+#          Kirill Simonov <xi@resolvent.net>
+#
+
+
+"""
+:mod:`htsql_sqlite.tr.coerce`
+=============================
+"""
+
+
+from htsql.adapter import adapts
+from htsql.domain import DecimalDomain, FloatDomain
+from htsql.tr.coerce import UnaryCoerce
+
+
+class SQLiteUnaryCoerceDecimal(UnaryCoerce):
+
+    adapts(DecimalDomain)
+
+    def __call__(self):
+        return FloatDomain()
+
+

src/htsql_sqlite/tr/dump.py

 class SQLiteDumpDate(DumpDate):
 
     def __call__(self):
-        self.write(str(self.value))
+        self.format("{value:literal}", value=str(self.value))
 
 
 class SQLiteDumpToFloat(DumpToFloat):

test/input/library.yaml

 id: library
 tests:
 
+- title: Literals
+  tests:
+
+  # Untyped literals, implicitly converted to string
+  - uri: /{null(), '', 'HTSQL'}
+
+  # Boolean values
+  - uri: /{true(), false()}
+  - uri: /{boolean('true'), boolean('false')}
+  # Invalid Boolean literals
+  - uri: /boolean('')
+    expect: 400
+  - uri: /boolean('yes')
+    expect: 400
+
+  # String values
+  - uri: /{'', 'HTSQL', 'O''Reilly',
+           '%ce%bb%cf%8c%ce%b3%ce%bf%cf%82',
+           '$-b \pm \sqrt{b^2 - 4ac} \over 2a$'}
+  - uri: /{string('832040')}
+
+  # Integer values
+  - uri: /{0, 7, -97, 3571}
+  - uri: /{integer('4862'), integer('-9694845')}
+  # 32-bit signed integers
+  - uri: /{integer('-2147483648'), integer('2147483647')}
+  # 64-bit signed integers
+  - uri: /{integer('-9223372036854775808'),
+           integer('9223372036854775807')}
+    ifndef: sqlite
+  # Invalid integer literal
+  - uri: /{integer('2.5e1')}
+    expect: 400
+  # Overflow 32-bit
+  - uri: /{4294967296}
+    expect: 400
+    ifndef: pgsql
+  # Overflow 64-bit
+  - uri: /{18446744073709551616}
+    expect: 400
+
+  # Decimal values
+  - uri: /{1.0, -2.5, 0.875}
+  - uri: /{decimal('1E-10')}
+  # Arbitrary length
+  - uri: /{4154781481226426191177580544000000.808017424794512875886459904961710757005754368000000000}
+  # Invalid decimal literals
+  - uri: /{decimal('vingt-cinq')}
+    expect: 400
+
+  # Float values
+  - uri: /{0e0, -57721e-5, 36288e2}
+  - uri: /{float('2147483647')}
+  # Invalid float literal
+  - uri: /float('vingt-cinq')
+    expect: 400
+  # Infinity
+  - uri: /{1e1024}
+    expect: 400
+  - uri: /{float('inf')}
+    expect: 400
+
+  # Date values
+  - uri: /{date('2010-04-15')}
+  # Invalid date
+  - uri: /date('2010-13-07')
+    expect: 400
+
+
+
 # FIXME: update and refurbish!
 
-- title: Literals
-  tests:
-  # String literals.
-  - uri: /{'','HTSQL','O''Reilly','λόγος',
-           '%01%02%03%04%05%06%07%08%09%0A%0B%0C%0D%0E%0F',
-           '%10%11%12%13%14%15%16%17%18%19%1A%1B%1C%1D%1E%1F'}
-  # Integer literals.
-  - uri: /{0,1,100,65536}
-  # Invalid integer literal (must be in range from -2**63 to 2**63-1).
-  - uri: /{115792089237316195423570985008687907853269984665640564039457584007913129639936}
-    expect: 400
-  # Decimal literals.
-  - uri: /{0.0,1.0,3.14,0.00000000001,1234567890.0987654321}
-  # Decimal values are of arbitrary size.
-  - uri: /{10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.1}
-  # Float literals.
-  - uri: /{0e0,1e1,0.31415926535897931e1,2718281828459045e-16}
-  # Non-nuleric float values.
-  - uri: /{1e1024,-1e1024,1e1024/1e1024}
 
 - title: Scalar functions
+  ifndef: sqlite
   tests:
   - title: Boolean constants and logical operators
     tests:
              date('2010-07-28')-date('2009-07-28')}
 
 - title: Table functions
+  ifndef: sqlite
   tests:
 
   # Sort and Limit functions.

test/input/sqlite.yaml

   - include: test/input/tutorial.yaml
   # Standard Data Types, Functions, and Operations
   - include: test/input/library.yaml
-    skip: true  # FIXME: poor support for standard functions
   # Edge Cases of HTSQL-to-SQL Translation
   - include: test/input/translation.yaml
   # Formatting Output Data

test/output/pgsql.yaml

       tests:
       - id: literals
         tests:
+        - uri: /{null(), '', 'HTSQL'}
+          status: 200 OK
+          headers:
+          - [Content-Type, text/plain; charset=UTF-8]
+          body: |2
+             |                       |
+            -+-----------------------+-
+             | null() | '' | 'HTSQL' |
+            -+--------+----+---------+-
+             |        | "" | HTSQL   |
+                               (1 row)
+
+             ----
+             /{null(),'','HTSQL'}
+             SELECT NULL,
+                    '',
+                    'HTSQL'
+        - uri: /{true(), false()}
+          status: 200 OK
+          headers:
+          - [Content-Type, text/plain; charset=UTF-8]
+          body: |2
+             |                  |
+            -+------------------+-
+             | true() | false() |
+            -+--------+---------+-
+             | true   | false   |
+                          (1 row)
+
+             ----
+             /{true(),false()}
+             SELECT TRUE,
+                    FALSE
+        - uri: /{boolean('true'), boolean('false')}
+          status: 200 OK
+          headers:
+          - [Content-Type, text/plain; charset=UTF-8]
+          body: |2
+             |                                    |
+            -+------------------------------------+-
+             | boolean('true') | boolean('false') |
+            -+-----------------+------------------+-
+             | true            | false            |
+                                            (1 row)
+
+             ----
+             /{boolean('true'),boolean('false')}
+             SELECT TRUE,
+                    FALSE
+        - uri: /boolean('')
+          status: 400 Bad Request
+          headers:
+          - [Content-Type, text/plain; charset=UTF-8]
+          body: |
+            encode error: invalid Boolean literal: expected 'true' or 'false'; got '':
+                /boolean('')
+                 ^^^^^^^^^^^
+        - uri: /boolean('yes')
+          status: 400 Bad Request
+          headers:
+          - [Content-Type, text/plain; charset=UTF-8]
+          body: |
+            encode error: invalid Boolean literal: expected 'true' or 'false'; got 'yes':
+                /boolean('yes')
+                 ^^^^^^^^^^^^^^
+        - uri: /{'', 'HTSQL', 'O''Reilly', '%ce%bb%cf%8c%ce%b3%ce%bf%cf%82', '$-b
+            \pm \sqrt{b^2 - 4ac} \over 2a$'}
+          status: 200 OK
+          headers:
+          - [Content-Type, text/plain; charset=UTF-8]
+          body: " |                                                                             |\n-+-----------------------------------------------------------------------------+-\n
+            | '' | 'HTSQL' | 'O''Reilly' | '\u03BB\u03CC\u03B3\u03BF\u03C2' | '$-b
+            \\pm \\sqrt{b^2 - 4ac} \\over 2a$' |\n-+----+---------+-------------+---------+--------------------------------------+-\n
+            | \"\" | HTSQL   | O'Reilly    | \u03BB\u03CC\u03B3\u03BF\u03C2   | $-b
+            \\pm \\sqrt{b^2 - 4ac} \\over 2a$   |\n                                                                         (1
+            row)\n\n ----\n /{'','HTSQL','O''Reilly','\u03BB\u03CC\u03B3\u03BF\u03C2','$-b
+            \\pm \\sqrt{b^2 - 4ac} \\over 2a$'}\n SELECT '',\n        'HTSQL',\n        'O''Reilly',\n
+            \       '\u03BB\u03CC\u03B3\u03BF\u03C2',\n        E'$-b \\\\pm \\\\sqrt{b^2
+            - 4ac} \\\\over 2a$'\n"
+        - uri: /{string('832040')}
+          status: 200 OK
+          headers:
+          - [Content-Type, text/plain; charset=UTF-8]
+          body: |2
+             |                  |
+            -+------------------+-
+             | string('832040') |
+            -+------------------+-
+             | 832040           |
+                          (1 row)
+
+             ----
+             /{string('832040')}
+             SELECT '832040'
+        - uri: /{0, 7, -97, 3571}
+          status: 200 OK
+          headers:
+          - [Content-Type, text/plain; charset=UTF-8]
+          body: |2
+             |                    |
+            -+--------------------+-
+             | 0 | 7 | -97 | 3571 |
+            -+---+---+-----+------+-
+             | 0 | 7 | -97 | 3571 |
+                            (1 row)
+
+             ----
+             /{0,7,-97,3571}
+             SELECT 0,
+                    7,
+                    (- 97),
+                    3571
+        - uri: /{integer('4862'), integer('-9694845')}
+          status: 200 OK
+          headers:
+          - [Content-Type, text/plain; charset=UTF-8]
+          body: |2
+             |                                       |
+            -+---------------------------------------+-
+             | integer('4862') | integer('-9694845') |
+            -+-----------------+---------------------+-
+             |            4862 |            -9694845 |
+                                               (1 row)
+
+             ----
+             /{integer('4862'),integer('-9694845')}
+             SELECT 4862,
+                    -9694845
+        - uri: /{integer('-2147483648'), integer('2147483647')}
+          status: 200 OK
+          headers:
+          - [Content-Type, text/plain; charset=UTF-8]
+          body: |2
+             |                                                |
+            -+------------------------------------------------+-
+             | integer('-2147483648') | integer('2147483647') |
+            -+------------------------+-----------------------+-
+             |            -2147483648 |            2147483647 |
+                                                        (1 row)
+
+             ----
+             /{integer('-2147483648'),integer('2147483647')}
+             SELECT -2147483648,
+                    2147483647
+        - uri: /{integer('-9223372036854775808'), integer('9223372036854775807')}
+          status: 200 OK
+          headers:
+          - [Content-Type, text/plain; charset=UTF-8]
+          body: |2
+             |                                                                  |
+            -+------------------------------------------------------------------+-
+             | integer('-9223372036854775808') | integer('9223372036854775807') |
+            -+---------------------------------+--------------------------------+-
+             |            -9223372036854775808 |            9223372036854775807 |
+                                                                          (1 row)
+
+             ----
+             /{integer('-9223372036854775808'),integer('9223372036854775807')}
+             SELECT -9223372036854775808,
+                    9223372036854775807
+        - uri: /{integer('2.5e1')}
+          status: 400 Bad Request
+          headers:
+          - [Content-Type, text/plain; charset=UTF-8]
+          body: |
+            encode error: invalid integer literal: expected an integer in a decimal format; got '2.5e1':
+                /{integer('2.5e1')}
+                  ^^^^^^^^^^^^^^^^
+        - uri: /{18446744073709551616}
+          status: 400 Bad Request
+          headers:
+          - [Content-Type, text/plain; charset=UTF-8]
+          body: |
+            serialize error: invalid integer value:
+                /{18446744073709551616}
+                  ^^^^^^^^^^^^^^^^^^^^
+        - uri: /{1.0, -2.5, 0.875}
+          status: 200 OK
+          headers:
+          - [Content-Type, text/plain; charset=UTF-8]
+          body: |2
+             |                    |
+            -+--------------------+-
+             | 1.0 | -2.5 | 0.875 |
+            -+-----+------+-------+-
+             | 1.0 | -2.5 | 0.875 |
+                            (1 row)
+
+             ----
+             /{1.0,-2.5,0.875}
+             SELECT 1.0::NUMERIC,
+                    (- 2.5::NUMERIC),
+                    0.875::NUMERIC
+        - uri: /{decimal('1E-10')}
+          status: 200 OK
+          headers:
+          - [Content-Type, text/plain; charset=UTF-8]
+          body: |2
+             |                  |
+            -+------------------+-
+             | decimal('1E-10') |
+            -+------------------+-
+             |            1E-10 |
+                          (1 row)
+
+             ----
+             /{decimal('1E-10')}
+             SELECT 1E-10::NUMERIC
+        - uri: /{4154781481226426191177580544000000.808017424794512875886459904961710757005754368000000000}
+          status: 200 OK
+          headers:
+          - [Content-Type, text/plain; charset=UTF-8]
+          body: |2
+             |                                                                                           |
+            -+-------------------------------------------------------------------------------------------+-
+             | 4154781481226426191177580544000000.808017424794512875886459904961710757005754368000000000 |
+            -+-------------------------------------------------------------------------------------------+-
+             | 4154781481226426191177580544000000.808017424794512875886459904961710757005754368000000000 |
+                                                                                                   (1 row)
+
+             ----
+             /{4154781481226426191177580544000000.808017424794512875886459904961710757005754368000000000}
+             SELECT 4154781481226426191177580544000000.808017424794512875886459904961710757005754368000000000::NUMERIC
+        - uri: /{decimal('vingt-cinq')}
+          status: 400 Bad Request
+          headers:
+          - [Content-Type, text/plain; charset=UTF-8]
+          body: |
+            encode error: invalid decimal literal: vingt-cinq:
+                /{decimal('vingt-cinq')}
+                  ^^^^^^^^^^^^^^^^^^^^^
+        - uri: /{0e0, -57721e-5, 36288e2}
+          status: 200 OK
+          headers:
+          - [Content-Type, text/plain; charset=UTF-8]
+          body: |2
+             |                             |
+            -+-----------------------------+-
+             | 0e0 | -57721e-5 | 36288e2   |
+            -+-----+-----------+-----------+-
+             | 0.0 |  -0.57721 | 3628800.0 |
+                                     (1 row)
+
+             ----
+             /{0e0,-57721e-5,36288e2}
+             SELECT 0.0::FLOAT8,
+                    (- 0.57721::FLOAT8),
+                    3628800.0::FLOAT8
+        - uri: /{float('2147483647')}
+          status: 200 OK
+          headers:
+          - [Content-Type, text/plain; charset=UTF-8]
+          body: |2
+             |                     |
+            -+---------------------+-
+             | float('2147483647') |
+            -+---------------------+-
+             |        2147483647.0 |
+                             (1 row)
+
+             ----
+             /{float('2147483647')}
+             SELECT 2147483647.0::FLOAT8
+        - uri: /float('vingt-cinq')
+          status: 400 Bad Request
+          headers:
+          - [Content-Type, text/plain; charset=UTF-8]
+          body: |
+            encode error: invalid float literal: vingt-cinq:
+                /float('vingt-cinq')
+                 ^^^^^^^^^^^^^^^^^^^
+        - uri: /{1e1024}
+          status: 400 Bad Request
+          headers:
+          - [Content-Type, text/plain; charset=UTF-8]
+          body: |
+            encode error: invalid float literal: inf:
+                /{1e1024}
+                  ^^^^^^
+        - uri: /{float('inf')}
+          status: 400 Bad Request
+          headers:
+          - [Content-Type, text/plain; charset=UTF-8]
+          body: |
+            encode error: invalid float literal: inf:
+                /{float('inf')}
+                  ^^^^^^^^^^^^
+        - uri: /{date('2010-04-15')}
+          status: 200 OK
+          headers:
+          - [Content-Type, text/plain; charset=UTF-8]
+          body: |2
+             |                    |
+            -+--------------------+-
+             | date('2010-04-15') |
+            -+--------------------+-
+             | 2010-04-15         |
+                            (1 row)
+
+             ----
+             /{date('2010-04-15')}
+             SELECT '2010-04-15'::DATE
+        - uri: /date('2010-13-07')
+          status: 400 Bad Request
+          headers:
+          - [Content-Type, text/plain; charset=UTF-8]
+          body: |
+            encode error: invalid date literal: month must be in 1..12:
+                /date('2010-13-07')
+                 ^^^^^^^^^^^^^^^^^^
         - uri: "/{'','HTSQL','O''Reilly','\u03BB\u03CC\u03B3\u03BF\u03C2', '%01%02%03%04%05%06%07%08%09%0A%0B%0C%0D%0E%0F',
             '%10%11%12%13%14%15%16%17%18%19%1A%1B%1C%1D%1E%1F'}"
           status: 200 OK
             headers:
             - [Content-Type, text/plain; charset=UTF-8]
             body: |
-              encode error: invalid decimal literal: Invalid literal for Decimal: 'X':
+              encode error: invalid decimal literal: X:
                   /{decimal('X')}
                     ^^^^^^^^^^^^
           - uri: /{decimal(string('X'))}
             headers:
             - [Content-Type, text/plain; charset=UTF-8]
             body: |
-              encode error: invalid float literal: invalid literal for float(): X:
+              encode error: invalid float literal: X:
                   /{float('X')}
                     ^^^^^^^^^^
           - uri: /{float(string('X'))}

test/output/sqlite.yaml

              ORDER BY 1 ASC, 2 ASC
              LIMIT 5
              OFFSET 20
+  - include: test/input/library.yaml
+    output:
+      id: library
+      tests:
+      - id: literals
+        tests:
+        - uri: /{null(), '', 'HTSQL'}
+          status: 200 OK
+          headers:
+          - [Content-Type, text/plain; charset=UTF-8]
+          body: |2
+             |                       |
+            -+-----------------------+-
+             | null() | '' | 'HTSQL' |
+            -+--------+----+---------+-
+             |        | "" | HTSQL   |
+                               (1 row)
+
+             ----
+             /{null(),'','HTSQL'}
+             SELECT NULL,
+                    '',
+                    'HTSQL'
+        - uri: /{true(), false()}
+          status: 200 OK
+          headers:
+          - [Content-Type, text/plain; charset=UTF-8]
+          body: |2
+             |                  |
+            -+------------------+-
+             | true() | false() |
+            -+--------+---------+-
+             | true   | false   |
+                          (1 row)
+
+             ----
+             /{true(),false()}
+             SELECT 1,
+                    0
+        - uri: /{boolean('true'), boolean('false')}
+          status: 200 OK
+          headers:
+          - [Content-Type, text/plain; charset=UTF-8]
+          body: |2
+             |                                    |
+            -+------------------------------------+-
+             | boolean('true') | boolean('false') |
+            -+-----------------+------------------+-
+             | true            | false            |
+                                            (1 row)
+
+             ----
+             /{boolean('true'),boolean('false')}
+             SELECT 1,
+                    0
+        - uri: /boolean('')
+          status: 400 Bad Request
+          headers:
+          - [Content-Type, text/plain; charset=UTF-8]
+          body: |
+            encode error: invalid Boolean literal: expected 'true' or 'false'; got '':
+                /boolean('')
+                 ^^^^^^^^^^^
+        - uri: /boolean('yes')
+          status: 400 Bad Request
+          headers:
+          - [Content-Type, text/plain; charset=UTF-8]
+          body: |
+            encode error: invalid Boolean literal: expected 'true' or 'false'; got 'yes':
+                /boolean('yes')
+                 ^^^^^^^^^^^^^^
+        - uri: /{'', 'HTSQL', 'O''Reilly', '%ce%bb%cf%8c%ce%b3%ce%bf%cf%82', '$-b
+            \pm \sqrt{b^2 - 4ac} \over 2a$'}
+          status: 200 OK
+          headers:
+          - [Content-Type, text/plain; charset=UTF-8]
+          body: " |                                                                             |\n-+-----------------------------------------------------------------------------+-\n
+            | '' | 'HTSQL' | 'O''Reilly' | '\u03BB\u03CC\u03B3\u03BF\u03C2' | '$-b
+            \\pm \\sqrt{b^2 - 4ac} \\over 2a$' |\n-+----+---------+-------------+---------+--------------------------------------+-\n
+            | \"\" | HTSQL   | O'Reilly    | \u03BB\u03CC\u03B3\u03BF\u03C2   | $-b
+            \\pm \\sqrt{b^2 - 4ac} \\over 2a$   |\n                                                                         (1
+            row)\n\n ----\n /{'','HTSQL','O''Reilly','\u03BB\u03CC\u03B3\u03BF\u03C2','$-b
+            \\pm \\sqrt{b^2 - 4ac} \\over 2a$'}\n SELECT '',\n        'HTSQL',\n        'O''Reilly',\n
+            \       '\u03BB\u03CC\u03B3\u03BF\u03C2',\n        '$-b \\pm \\sqrt{b^2
+            - 4ac} \\over 2a$'\n"
+        - uri: /{string('832040')}
+          status: 200 OK
+          headers:
+          - [Content-Type, text/plain; charset=UTF-8]
+          body: |2
+             |                  |
+            -+------------------+-
+             | string('832040') |
+            -+------------------+-
+             | 832040           |
+                          (1 row)
+
+             ----
+             /{string('832040')}
+             SELECT '832040'
+        - uri: /{0, 7, -97, 3571}
+          status: 200 OK
+          headers:
+          - [Content-Type, text/plain; charset=UTF-8]
+          body: |2
+             |                    |
+            -+--------------------+-
+             | 0 | 7 | -97 | 3571 |
+            -+---+---+-----+------+-
+             | 0 | 7 | -97 | 3571 |
+                            (1 row)
+
+             ----
+             /{0,7,-97,3571}
+             SELECT 0,
+                    7,
+                    (- 97),
+                    3571
+        - uri: /{integer('4862'), integer('-9694845')}
+          status: 200 OK
+          headers:
+          - [Content-Type, text/plain; charset=UTF-8]
+          body: |2
+             |                                       |
+            -+---------------------------------------+-
+             | integer('4862') | integer('-9694845') |
+            -+-----------------+---------------------+-
+             |            4862 |            -9694845 |
+                                               (1 row)
+
+             ----
+             /{integer('4862'),integer('-9694845')}
+             SELECT 4862,
+                    -9694845
+        - uri: /{integer('-2147483648'), integer('2147483647')}
+          status: 200 OK
+          headers:
+          - [Content-Type, text/plain; charset=UTF-8]
+          body: |2
+             |                                                |
+            -+------------------------------------------------+-
+             | integer('-2147483648') | integer('2147483647') |
+            -+------------------------+-----------------------+-
+             |            -2147483648 |            2147483647 |
+                                                        (1 row)
+
+             ----
+             /{integer('-2147483648'),integer('2147483647')}
+             SELECT -2147483648,
+                    2147483647
+        - uri: /{integer('2.5e1')}
+          status: 400 Bad Request
+          headers:
+          - [Content-Type, text/plain; charset=UTF-8]
+          body: |
+            encode error: invalid integer literal: expected an integer in a decimal format; got '2.5e1':
+                /{integer('2.5e1')}
+                  ^^^^^^^^^^^^^^^^
+        - uri: /{4294967296}
+          status: 400 Bad Request
+          headers:
+          - [Content-Type, text/plain; charset=UTF-8]
+          body: |
+            serialize error: invalid integer value:
+                /{4294967296}
+                  ^^^^^^^^^^
+        - uri: /{18446744073709551616}
+          status: 400 Bad Request
+          headers:
+          - [Content-Type, text/plain; charset=UTF-8]
+          body: |
+            serialize error: invalid integer value:
+                /{18446744073709551616}
+                  ^^^^^^^^^^^^^^^^^^^^
+        - uri: /{1.0, -2.5, 0.875}
+          status: 200 OK
+          headers:
+          - [Content-Type, text/plain; charset=UTF-8]
+          body: |2
+             |                    |
+            -+--------------------+-
+             | 1.0 | -2.5 | 0.875 |
+            -+-----+------+-------+-
+             | 1.0 | -2.5 | 0.875 |
+                            (1 row)
+
+             ----
+             /{1.0,-2.5,0.875}
+             SELECT 1.0,
+                    (- 2.5),
+                    0.875
+        - uri: /{decimal('1E-10')}
+          status: 200 OK
+          headers:
+          - [Content-Type, text/plain; charset=UTF-8]
+          body: |2
+             |                  |
+            -+------------------+-
+             | decimal('1E-10') |
+            -+------------------+-
+             |            1e-10 |
+                          (1 row)
+
+             ----
+             /{decimal('1E-10')}
+             SELECT 1e-10
+        - uri: /{4154781481226426191177580544000000.808017424794512875886459904961710757005754368000000000}
+          status: 200 OK
+          headers:
+          - [Content-Type, text/plain; charset=UTF-8]
+          body: |2
+             |                                                                                           |
+            -+-------------------------------------------------------------------------------------------+-
+             | 4154781481226426191177580544000000.808017424794512875886459904961710757005754368000000000 |
+            -+-------------------------------------------------------------------------------------------+-
+             |                                                                         4.15478148123e+33 |
+                                                                                                   (1 row)
+
+             ----
+             /{4154781481226426191177580544000000.808017424794512875886459904961710757005754368000000000}
+             SELECT 4.154781481226426e+33
+        - uri: /{decimal('vingt-cinq')}
+          status: 400 Bad Request
+          headers:
+          - [Content-Type, text/plain; charset=UTF-8]
+          body: |
+            encode error: invalid float literal: vingt-cinq:
+                /{decimal('vingt-cinq')}
+                  ^^^^^^^^^^^^^^^^^^^^^
+        - uri: /{0e0, -57721e-5, 36288e2}
+          status: 200 OK
+          headers:
+          - [Content-Type, text/plain; charset=UTF-8]
+          body: |2
+             |                             |
+            -+-----------------------------+-
+             | 0e0 | -57721e-5 | 36288e2   |
+            -+-----+-----------+-----------+-
+             | 0.0 |  -0.57721 | 3628800.0 |
+                                     (1 row)
+
+             ----
+             /{0e0,-57721e-5,36288e2}
+             SELECT 0.0,
+                    (- 0.57721),
+                    3628800.0
+        - uri: /{float('2147483647')}
+          status: 200 OK
+          headers:
+          - [Content-Type, text/plain; charset=UTF-8]
+          body: |2
+             |                     |
+            -+---------------------+-
+             | float('2147483647') |
+            -+---------------------+-
+             |        2147483647.0 |
+                             (1 row)
+
+             ----
+             /{float('2147483647')}
+             SELECT 2147483647.0
+        - uri: /float('vingt-cinq')
+          status: 400 Bad Request
+          headers:
+          - [Content-Type, text/plain; charset=UTF-8]
+          body: |
+            encode error: invalid float literal: vingt-cinq:
+                /float('vingt-cinq')
+                 ^^^^^^^^^^^^^^^^^^^
+        - uri: /{1e1024}
+          status: 400 Bad Request
+          headers:
+          - [Content-Type, text/plain; charset=UTF-8]
+          body: |
+            encode error: invalid float literal: inf:
+                /{1e1024}
+                  ^^^^^^
+        - uri: /{float('inf')}
+          status: 400 Bad Request
+          headers:
+          - [Content-Type, text/plain; charset=UTF-8]
+          body: |
+            encode error: invalid float literal: inf:
+                /{float('inf')}
+                  ^^^^^^^^^^^^
+        - uri: /{date('2010-04-15')}
+          status: 200 OK
+          headers:
+          - [Content-Type, text/plain; charset=UTF-8]
+          body: |2
+             |                    |
+            -+--------------------+-
+             | date('2010-04-15') |
+            -+--------------------+-
+             | 2010-04-15         |
+                            (1 row)
+
+             ----
+             /{date('2010-04-15')}
+             SELECT '2010-04-15'
+        - uri: /date('2010-13-07')
+          status: 400 Bad Request
+          headers:
+          - [Content-Type, text/plain; charset=UTF-8]
+          body: |
+            encode error: invalid date literal: month must be in 1..12:
+                /date('2010-13-07')
+                 ^^^^^^^^^^^^^^^^^^
   - include: test/input/translation.yaml
     output:
       id: translation
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.