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')
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')
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'α,γ,β')
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')
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')
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'κάΠΠα')
def test_modifier_e_directcall_unicode(self): self.assertEqual( modifier_as_function(u'e/./sed "y~฿₯﷼£¥~¥£﷼₯฿~"/')(u'¥£﷼₯฿'), u'฿₯﷼£¥')
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')
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'α,γ,β')
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')
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')
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')
def test_modifier_e_directcall_unicode(self): self.assertEqual(modifier_as_function(u'e/./sed "y~฿₯﷼£¥~¥£﷼₯฿~"/')(u'¥£﷼₯฿'), u'฿₯﷼£¥')
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')
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')