Difference between revisions of "Processing test"

From Open Food Facts wiki
Jump to navigation Jump to search
Line 3: Line 3:
 
All tests follow the same structure. There is one test set per language. For each process adjective there is a separate test. And a test consists of a string and the required results (ingredient and process).
 
All tests follow the same structure. There is one test set per language. For each process adjective there is a separate test. And a test consists of a string and the required results (ingredient and process).
  
 +
== Template ==
 
The template for processing adjectives tests:
 
The template for processing adjectives tests:
  
Line 43: Line 44:
 
   }
 
   }
 
   ] ]
 
   ] ]
 +
== Error message ==
 +
An error message for the '''text''' field might be:
 +
  #  Failed test at t/ingredients_processing.t line 143.
 +
  #    Structures begin differing at:
 +
  #          $got->[3]{text} = 'gehakte tomaten'
 +
  #    $expected->[3]{text} = 'tomaten'
 +
This should be read as: replace ''gehakte tomaten'' with ''tomaten'' in the test

Revision as of 18:23, 22 March 2020

< Processing Taxonomy

All tests follow the same structure. There is one test set per language. For each process adjective there is a separate test. And a test consists of a string and the required results (ingredient and process).

Template

The template for processing adjectives tests:

  [ { 

Define the language for which the tests are applicable.

  lc => "en",

Define in the ingredients_text the original ingredients that must be tested. These should have the format process ingredient, ingredient process, or whatever is applicable for that language.

  ingredients_text => "raw milk, sliced tomatoes, garlic powder, powdered eggplant, courgette powder" },

The ingredients_text raw milk, should result in the ingredient with id en: raw milk. The adjective is ignored.

  [ {
      'id' => 'en:raw-milk',
      'text' => 'raw milk'
    },

The ingredients_text sliced tomatoes, should result in the ingredient with id en:tomato and processing en:sliced.

    {
      'id' => 'en:tomato',

The id represents the parent key of sliced tomatoes in the ingredients taxonomy.

      'processing' => 'en:sliced',

The processing is the key of sliced in the processing taxonomy.

      'text' => 'tomatoes'

The text is parent key of the entry sliced tomatoes in the ingredients taxonomy ????

    },
    {
      'id' => 'en:garlic-powder',
      'text' => 'garlic powder'
    },
 {
   'id' => 'en:aubergine',
   'processing' => 'en:powdered',
   'text' => 'eggplant'
 },
 {
   'id' => 'en:courgette',
   'processing' => 'en:powdered',
   'text' => 'courgette'
  }
  ] ]

Error message

An error message for the text field might be:

  #   Failed test at t/ingredients_processing.t line 143.
  #     Structures begin differing at:
  #          $got->[3]{text} = 'gehakte tomaten'
  #     $expected->[3]{text} = 'tomaten'

This should be read as: replace gehakte tomaten with tomaten in the test