Esempio n. 1
0
 def test_modifier_e_directcall_filter(self):
     self.assertEqual(
         modifier_as_function(u'e/^[0-9]+$/xargs -I {} echo "{}^2" | bc/')(
             u'4'), u'16')
     self.assertEqual(
         modifier_as_function(u'e/^[0-9]+$/xargs -I {} echo "{}^2" | bc/')(
             u'4a'), u'4a')
Esempio n. 2
0
 def test_modifier_s_directcall(self):
     self.assertEqual(modifier_as_function(u's/a/b/')(u'abcabc'), u'bbcabc')
     self.assertEqual(
         modifier_as_function(u's/a/b/g')(u'abcabc'), u'bbcbbc')
     self.assertEqual(
         modifier_as_function(u's/a/b/g')(u'abcABC'), u'bbcABC')
     self.assertEqual(
         modifier_as_function(u's/a/b/gi')(u'abcABC'), u'bbcbBC')
Esempio n. 3
0
 def test_modifier_y_directcall_unicode(self):
     self.assertEqual(
         modifier_as_function(u'y/abc/def/')(u'b,a,c'), u'e,d,f')
     self.assertEqual(
         modifier_as_function(u'y/abc/def/')(u'b,a,c'), u'e,d,f')
     self.assertEqual(
         modifier_as_function(u'y/αβγ/abg/')(u'β,α,γ'), u'b,a,g')
     self.assertEqual(
         modifier_as_function(u'y/abg/αβγ/')(u'b,a,g'), u'β,α,γ')
     self.assertEqual(
         modifier_as_function(u'y/αβγ/γαβ/')(u'β,α,γ'), u'α,γ,β')
Esempio n. 4
0
 def test_modifier_y_directcall(self):
     self.assertEqual(
         modifier_as_function(u'y/abc/def/')(u'b,a,c'), u'e,d,f')
     self.assertEqual(
         modifier_as_function(u'y/abc/def/')(u'b,A,C'), u'e,A,C')
     self.assertEqual(
         modifier_as_function(u'y/abc/def/i')(u'b,A,C'), u'e,d,f')
     self.assertEqual(
         modifier_as_function(u'y/a-z/A-Z/')(u'Back-Up'), u'BACK-UP')
     self.assertEqual(
         modifier_as_function(u'y/a\-z/A~Z/')(u'Back-Up'), u'BAck~Up')
Esempio n. 5
0
 def test_modifier_e_directcall_backref(self):
     self.assertEqual(
         modifier_as_function(
             u'e/^([0-9]+)(€?)$/echo "\\2"; echo "\\1^2" | bc/')(u'4'),
         u'16')
     self.assertEqual(
         modifier_as_function(
             u'e/^([0-9]+)(€?)$/echo "\\2"; echo "\\1^2" | bc/')(u'4€'),
         u'€16')
     self.assertEqual(
         modifier_as_function(
             u'e/^([0-9]+)(€?)$/echo "\\2"; echo "\\1^2" | bc/')(u'€4'),
         u'€4')
Esempio n. 6
0
 def test_modifier_s_directcall_unicode(self):
     self.assertEqual(modifier_as_function(u's/π/p/')(u'κάππα'), u'κάpπα')
     self.assertEqual(modifier_as_function(u's/π/p/g')(u'κάππα'), u'κάppα')
     self.assertEqual(modifier_as_function(u's/π/Π/')(u'κάππα'), u'κάΠπα')
     self.assertEqual(modifier_as_function(u's/π/Π/g')(u'κάππα'), u'κάΠΠα')
Esempio n. 7
0
 def test_modifier_e_directcall_unicode(self):
     self.assertEqual(
         modifier_as_function(u'e/./sed "y~฿₯﷼£¥~¥£﷼₯฿~"/')(u'¥£﷼₯฿'),
         u'฿₯﷼£¥')
Esempio n. 8
0
 def test_modifier_s_directcall_unicode(self):
     self.assertEqual(modifier_as_function(u's/π/p/')(u'κάππα'), u'κάpπα')
     self.assertEqual(modifier_as_function(u's/π/p/g')(u'κάππα'), u'κάppα')
     self.assertEqual(modifier_as_function(u's/π/Π/')(u'κάππα'), u'κάΠπα')
     self.assertEqual(modifier_as_function(u's/π/Π/g')(u'κάππα'), u'κάΠΠα')
Esempio n. 9
0
 def test_modifier_e_directcall(self):
     self.assertEqual(
         modifier_as_function(u'e/./tr ab xy/')(u'b,a,c'), u'y,x,c')
     self.assertEqual(
         modifier_as_function(u'e/./xargs -I {} echo "{}^2" | bc/')(u'4'),
         u'16')
Esempio n. 10
0
 def test_modifier_y_directcall_unicode(self):
     self.assertEqual(modifier_as_function(u'y/abc/def/')(u'b,a,c'), u'e,d,f')
     self.assertEqual(modifier_as_function(u'y/abc/def/')(u'b,a,c'), u'e,d,f')
     self.assertEqual(modifier_as_function(u'y/αβγ/abg/')(u'β,α,γ'), u'b,a,g')
     self.assertEqual(modifier_as_function(u'y/abg/αβγ/')(u'b,a,g'), u'β,α,γ')
     self.assertEqual(modifier_as_function(u'y/αβγ/γαβ/')(u'β,α,γ'), u'α,γ,β')
Esempio n. 11
0
 def test_modifier_s_directcall(self):
     self.assertEqual(modifier_as_function(u's/a/b/')(u'abcabc'), u'bbcabc')
     self.assertEqual(modifier_as_function(u's/a/b/g')(u'abcabc'), u'bbcbbc')
     self.assertEqual(modifier_as_function(u's/a/b/g')(u'abcABC'), u'bbcABC')
     self.assertEqual(modifier_as_function(u's/a/b/gi')(u'abcABC'), u'bbcbBC')
Esempio n. 12
0
 def test_modifier_y_directcall(self):
     self.assertEqual(modifier_as_function(u'y/abc/def/')(u'b,a,c'), u'e,d,f')
     self.assertEqual(modifier_as_function(u'y/abc/def/')(u'b,A,C'), u'e,A,C')
     self.assertEqual(modifier_as_function(u'y/abc/def/i')(u'b,A,C'), u'e,d,f')
     self.assertEqual(modifier_as_function(u'y/a-z/A-Z/')(u'Back-Up'), u'BACK-UP')
     self.assertEqual(modifier_as_function(u'y/a\-z/A~Z/')(u'Back-Up'), u'BAck~Up')
Esempio n. 13
0
 def test_modifier_e_directcall_backref(self):
     self.assertEqual(modifier_as_function(u'e/^([0-9]+)(€?)$/echo "\\2"; echo "\\1^2" | bc/')(u'4'), u'16')
     self.assertEqual(modifier_as_function(u'e/^([0-9]+)(€?)$/echo "\\2"; echo "\\1^2" | bc/')(u'4€'), u'€16')
     self.assertEqual(modifier_as_function(u'e/^([0-9]+)(€?)$/echo "\\2"; echo "\\1^2" | bc/')(u'€4'), u'€4')
Esempio n. 14
0
 def test_modifier_e_directcall_unicode(self):
     self.assertEqual(modifier_as_function(u'e/./sed "y~฿₯﷼£¥~¥£﷼₯฿~"/')(u'¥£﷼₯฿'), u'฿₯﷼£¥')
Esempio n. 15
0
 def test_modifier_e_directcall_filter(self):
     self.assertEqual(modifier_as_function(u'e/^[0-9]+$/xargs -I {} echo "{}^2" | bc/')(u'4'), u'16')
     self.assertEqual(modifier_as_function(u'e/^[0-9]+$/xargs -I {} echo "{}^2" | bc/')(u'4a'), u'4a')
Esempio n. 16
0
 def test_modifier_e_directcall(self):
     self.assertEqual(modifier_as_function(u'e/./tr ab xy/')(u'b,a,c'), u'y,x,c')
     self.assertEqual(modifier_as_function(u'e/./xargs -I {} echo "{}^2" | bc/')(u'4'), u'16')