Ejemplo n.º 1
0
 GS1Message(
     value="010703206980498815210526100329",
     element_strings=[
         GS1ElementString(
             ai=GS1ApplicationIdentifier(
                 ai="01",
                 description="Global Trade Item Number (GTIN)",
                 data_title="GTIN",
                 fnc1_required=False,
                 format="N2+N14",
                 pattern="^01(\\d{14})$",
             ),
             value="07032069804988",
             pattern_groups=["07032069804988"],
             gtin=Gtin(
                 value="07032069804988",
                 format=GtinFormat.GTIN_13,
                 prefix=GS1Prefix(value="703", usage="GS1 Norway"),
                 payload="703206980498",
                 check_digit=8,
             ),
         ),
         GS1ElementString(
             ai=GS1ApplicationIdentifier(
                 ai="15",
                 description="Best before date (YYMMDD)",
                 data_title="BEST BEFORE or BEST BY",
                 fnc1_required=False,
                 format="N2+N6",
                 pattern="^15(\\d{6})$",
             ),
             value="210526",
             pattern_groups=["210526"],
             date=date(2021, 5, 26),
         ),
         GS1ElementString(
             ai=GS1ApplicationIdentifier(
                 ai="10",
                 description="Batch or lot number",
                 data_title="BATCH/LOT",
                 fnc1_required=True,
                 format="N2+X..20",
                 pattern=(
                     r"^10([\x21-\x22\x25-\x2F\x30-\x39\x3A-\x3F"
                     r"\x41-\x5A\x5F\x61-\x7A]{0,20})$"),
             ),
             value="0329",
             pattern_groups=["0329"],
         ),
     ],
 ),
Ejemplo n.º 2
0
     # GTIN-8
     "96385074",
     ParseResult(
         value="96385074",
         gtin=Gtin(
             value="96385074",
             format=GtinFormat.GTIN_8,
             prefix=GS1Prefix(value="00009", usage="GS1 US"),
             payload="9638507",
             check_digit=4,
         ),
         gs1_message=GS1Message(
             value="96385074",
             element_strings=[
                 GS1ElementString(
                     ai=GS1ApplicationIdentifier.extract("96"),
                     value="385074",
                     pattern_groups=["385074"],
                 )
             ],
         ),
         sscc_error=
         ("Failed to parse '96385074' as SSCC: Expected 18 digits, got 8."
          ),
     ),
 ),
 (
     # GTIN-12
     "123601057072",
     ParseResult(
         value="123601057072",
         gtin=Gtin(