File: null_flush_invalid_stream_format.py

package info (click to toggle)
lttoolbox 3.8.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,516 kB
  • sloc: cpp: 13,541; ansic: 3,131; python: 1,212; makefile: 17
file content (42 lines) | stat: -rw-r--r-- 2,151 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

import sys
import unittest
from proctest import ProcTest

# These tests are for invalid Apertium Stream format; lt-proc's output
# for these seems system-dependent, so we can't use them as regression
# tests (until that's fixed, if it's worth fixing).

class NoSuperblankBeforeNUL(unittest.TestCase, ProcTest):
    inputs = ["The dog gladly eats homework.",
              "If wé swim fast enough,",
              "we should reach shallow waters.",
              "before;",
              "the sharks;",
              "come."]

    expectedOutputs = ["^The/The<det><def><sp>$ ^dog/dog<n><sg>$ ^gladly/gladly<adv>$ ^eats/eat<vblex><pri><p3><sg>$ ^homework/homework<n><unc><sg>$",
                       "^If/If<cnjadv>$ ^wé/*wé$ ^swim/swim<vblex><inf>/swim<vblex><pres>$ ^fast/fast<adj><sint>/fast<n><sg>$ ^enough/enough<adv>/enough<det><qnt><sp>$",
                       "^we/prpers<prn><subj><p1><mf><pl>$ ^should/should<vaux><inf>$ ^reach/reach<vblex><inf>/reach<vblex><pres>$ ^shallow/shallow<adj><sint>$ ^waters/water<n><pl>$",
                       "^before/before<adv>/before<cnjadv>/before<pr>$",
                       "^the/the<det><def><sp>$ ^sharks/shark<n><pl>$",
                       "^come/come<vblex><inf>/come<vblex><pres>/come<vblex><pp>$"]

class WronglyEscapedLetter(unittest.TestCase, ProcTest):
    inputs = ["before you g\\o to bed.[][\n]"]
    expectedOutputs = ["^before/before<adv>/before<cnjadv>/before<pr>$ ^you/prpers<prn><subj><p2><mf><sp>/prpers<prn><obj><p2><mf><sp>$ "]
    expectedRetCodeFail = True


class UnescapedAngleBracket(unittest.TestCase, ProcTest):
    inputs = ["Simon prefers dark chocolate>.[][\n]"]
    expectedOutputs = ["^Simon/Simon<np><ant><m><sg>$ ^prefers/prefer<vblex><pri><p3><sg>$ ^dark/dark<adj><sint>/dark<n><sg>$ "]
    expectedRetCodeFail = True

class UnclosedSuperblank(unittest.TestCase, ProcTest):
    inputs = ["you should always[ eat"]
    #expectedOutputs = ["^you/prpers<prn><subj><p2><mf><sp>/prpers<prn><obj><p2><mf><sp>$ ^should/should<vaux><inf>$ "]
    expectedOutputs = [""]
    expectedRetCodeFail = True