예제 #1
0
 def test_replacement__omitted(self):
     replacer = __unit__.replace(self.SIMPLE_NEEDLE)
     self._assertReplacer(replacer, [self.SIMPLE_NEEDLE])
예제 #2
0
 def test_needle__empty_iterable(self):
     with self.assertRaises(ValueError) as r:
         __unit__.replace([])
     self.assertIn("empty", str(r.exception))
예제 #3
0
 def test_needle__list(self):
     replacer = __unit__.replace(self.LIST_NEEDLE)
     self._assertReplacer(replacer, self.LIST_NEEDLE)
예제 #4
0
 def test_haystack__duplicate__double_fluent(self):
     result = __unit__.replace(self.SIMPLE_NEEDLE,
                               with_=self.SIMPLE_REPLACEMENT).in_(
                                   self.HAYSTACK)
     with self._assertRaisesAttributeError('in_'):
         result.in_(self.HAYSTACK)
예제 #5
0
파일: test_strings.py 프로젝트: Xion/taipan
 def test_needle__non_string(self):
     with self.assertRaises(TypeError):
         __unit__.replace(object())
예제 #6
0
 def test_replacement__fluent__some_string(self):
     replacer = __unit__.replace(self.SIMPLE_NEEDLE).with_(
         self.SIMPLE_REPLACEMENT)
     self._assertReplacer(replacer,
                          {self.SIMPLE_NEEDLE: self.SIMPLE_REPLACEMENT})
예제 #7
0
 def test_haystack__fluent__none(self):
     with self.assertRaises(TypeError) as r:
         __unit__.replace(self.SIMPLE_NEEDLE,
                          with_=self.SIMPLE_REPLACEMENT).in_(None)
     self.assertIn("None", str(r.exception))
예제 #8
0
파일: test_strings.py 프로젝트: Xion/taipan
 def test_replacement__param__none(self):
     replacer = __unit__.replace(self.SIMPLE_NEEDLE, with_=None)
     self._assertReplacer(replacer, [self.SIMPLE_NEEDLE])
예제 #9
0
파일: test_strings.py 프로젝트: Xion/taipan
 def test_replacement__param__empty_string(self):
     replacer = __unit__.replace(self.SIMPLE_NEEDLE, with_="")
     self._assertReplacer(replacer, {self.SIMPLE_NEEDLE: ""})
예제 #10
0
파일: test_strings.py 프로젝트: Xion/taipan
 def test_needle__mapping(self):
     replacer = __unit__.replace(self.MAP_REPLACEMENTS)
     self._assertReplacer(replacer, self.MAP_REPLACEMENTS)
예제 #11
0
파일: test_strings.py 프로젝트: Xion/taipan
 def test_replacement__omitted(self):
     replacer = __unit__.replace(self.SIMPLE_NEEDLE)
     self._assertReplacer(replacer, [self.SIMPLE_NEEDLE])
예제 #12
0
파일: test_strings.py 프로젝트: Xion/taipan
 def test_needle__list(self):
     replacer = __unit__.replace(self.LIST_NEEDLE)
     self._assertReplacer(replacer, self.LIST_NEEDLE)
예제 #13
0
파일: test_strings.py 프로젝트: Xion/taipan
 def test_needle__some_string(self):
     replacer = __unit__.replace(self.SIMPLE_NEEDLE)
     self._assertReplacer(replacer, [self.SIMPLE_NEEDLE])
예제 #14
0
파일: test_strings.py 프로젝트: Xion/taipan
 def test_needle__empty_iterable(self):
     with self.assertRaises(ValueError) as r:
         __unit__.replace([])
     self.assertIn("empty", str(r.exception))
예제 #15
0
 def test_replacement__param__empty_string(self):
     replacer = __unit__.replace(self.SIMPLE_NEEDLE, with_="")
     self._assertReplacer(replacer, {self.SIMPLE_NEEDLE: ""})
예제 #16
0
파일: test_strings.py 프로젝트: Xion/taipan
 def test_replacement__fluent__none(self):
     with self.assertRaises(TypeError):
         __unit__.replace(self.SIMPLE_NEEDLE).with_(None)
예제 #17
0
 def test_replacement__fluent__non_string(self):
     with self.assertRaises(TypeError):
         __unit__.replace(self.SIMPLE_NEEDLE).with_(object())
예제 #18
0
파일: test_strings.py 프로젝트: Xion/taipan
 def test_replacement__fluent__non_string(self):
     with self.assertRaises(TypeError):
         __unit__.replace(self.SIMPLE_NEEDLE).with_(object())
예제 #19
0
 def test_haystack__param__none(self):
     replacer = __unit__.replace(self.SIMPLE_NEEDLE,
                                 with_=self.SIMPLE_REPLACEMENT,
                                 in_=None)
     self._assertReplacer(replacer,
                          {self.SIMPLE_NEEDLE: self.SIMPLE_REPLACEMENT})
예제 #20
0
파일: test_strings.py 프로젝트: Xion/taipan
 def test_replacement__fluent__empty_string(self):
     replacer = __unit__.replace(self.SIMPLE_NEEDLE).with_("")
     self._assertReplacer(replacer, {self.SIMPLE_NEEDLE: ""})
예제 #21
0
 def test_haystack__fluent__empty_string(self):
     result = __unit__.replace(self.SIMPLE_NEEDLE,
                               with_=self.SIMPLE_REPLACEMENT).in_("")
     self.assertEquals("", result)
예제 #22
0
파일: test_strings.py 프로젝트: Xion/taipan
 def test_replacement__fluent__some_string(self):
     replacer = __unit__.replace(
         self.SIMPLE_NEEDLE).with_(self.SIMPLE_REPLACEMENT)
     self._assertReplacer(replacer,
                          {self.SIMPLE_NEEDLE: self.SIMPLE_REPLACEMENT})
예제 #23
0
 def test_replace__list(self):
     result = __unit__.replace(self.LIST_NEEDLE).with_(
         self.LIST_REPLACEMENT).in_(self.HAYSTACK)
     self.assertEquals(self.LIST_RESULT, result)
예제 #24
0
파일: test_strings.py 프로젝트: Xion/taipan
 def test_replacement__duplicate__double_fluent(self):
     replacer = __unit__.replace(
         self.SIMPLE_NEEDLE).with_(self.SIMPLE_REPLACEMENT)
     with self.assertRaises(__unit__.ReplacementError):
         replacer.with_(self.SIMPLE_REPLACEMENT)
예제 #25
0
 def test_needle__non_string(self):
     with self.assertRaises(TypeError):
         __unit__.replace(object())
예제 #26
0
파일: test_strings.py 프로젝트: Xion/taipan
 def test_haystack__param__none(self):
     replacer = __unit__.replace(
         self.SIMPLE_NEEDLE, with_=self.SIMPLE_REPLACEMENT, in_=None)
     self._assertReplacer(replacer,
                          {self.SIMPLE_NEEDLE: self.SIMPLE_REPLACEMENT})
예제 #27
0
 def test_needle__some_string(self):
     replacer = __unit__.replace(self.SIMPLE_NEEDLE)
     self._assertReplacer(replacer, [self.SIMPLE_NEEDLE])
예제 #28
0
파일: test_strings.py 프로젝트: Xion/taipan
 def test_haystack__param__empty_string(self):
     result = __unit__.replace(
         self.SIMPLE_REPLACEMENT, with_=self.SIMPLE_REPLACEMENT, in_="")
     self.assertEquals("", result)
예제 #29
0
 def test_needle__mapping(self):
     replacer = __unit__.replace(self.MAP_REPLACEMENTS)
     self._assertReplacer(replacer, self.MAP_REPLACEMENTS)
예제 #30
0
파일: test_strings.py 프로젝트: Xion/taipan
 def test_haystack__fluent__none(self):
     with self.assertRaises(TypeError) as r:
         __unit__.replace(
             self.SIMPLE_NEEDLE, with_=self.SIMPLE_REPLACEMENT).in_(None)
     self.assertIn("None", str(r.exception))
예제 #31
0
 def test_replacement__param__none(self):
     replacer = __unit__.replace(self.SIMPLE_NEEDLE, with_=None)
     self._assertReplacer(replacer, [self.SIMPLE_NEEDLE])
예제 #32
0
파일: test_strings.py 프로젝트: Xion/taipan
 def test_haystack__fluent__non_string(self):
     with self.assertRaises(TypeError):
         __unit__.replace(self.SIMPLE_NEEDLE,
                          with_=self.SIMPLE_REPLACEMENT).in_(object())
예제 #33
0
 def test_replacement__fluent__none(self):
     with self.assertRaises(TypeError):
         __unit__.replace(self.SIMPLE_NEEDLE).with_(None)
예제 #34
0
파일: test_strings.py 프로젝트: Xion/taipan
 def test_haystack__fluent__empty_string(self):
     result = __unit__.replace(
         self.SIMPLE_NEEDLE, with_=self.SIMPLE_REPLACEMENT).in_("")
     self.assertEquals("", result)
예제 #35
0
 def test_replacement__fluent__empty_string(self):
     replacer = __unit__.replace(self.SIMPLE_NEEDLE).with_("")
     self._assertReplacer(replacer, {self.SIMPLE_NEEDLE: ""})
예제 #36
0
파일: test_strings.py 프로젝트: Xion/taipan
 def test_haystack__fluent__some_string(self):
     result = __unit__.replace(
         self.SIMPLE_NEEDLE,
         with_=self.SIMPLE_REPLACEMENT).in_(self.HAYSTACK)
     self.assertEquals(self.SIMPLE_RESULT, result)
예제 #37
0
 def test_replacement__duplicate__double_fluent(self):
     replacer = __unit__.replace(self.SIMPLE_NEEDLE).with_(
         self.SIMPLE_REPLACEMENT)
     with self.assertRaises(__unit__.ReplacementError):
         replacer.with_(self.SIMPLE_REPLACEMENT)
예제 #38
0
파일: test_strings.py 프로젝트: Xion/taipan
 def test_haystack__duplicate__double_fluent(self):
     result = __unit__.replace(
         self.SIMPLE_NEEDLE, with_=self.SIMPLE_REPLACEMENT).in_(
         self.HAYSTACK)
     with self._assertRaisesAttributeError('in_'):
         result.in_(self.HAYSTACK)
예제 #39
0
 def test_haystack__param__empty_string(self):
     result = __unit__.replace(self.SIMPLE_REPLACEMENT,
                               with_=self.SIMPLE_REPLACEMENT,
                               in_="")
     self.assertEquals("", result)
예제 #40
0
파일: test_strings.py 프로젝트: Xion/taipan
 def test_replace__simple(self):
     result = __unit__.replace(
         self.SIMPLE_NEEDLE).with_(
         self.SIMPLE_REPLACEMENT).in_(self.HAYSTACK)
     self.assertEquals(self.SIMPLE_RESULT, result)
예제 #41
0
 def test_haystack__fluent__non_string(self):
     with self.assertRaises(TypeError):
         __unit__.replace(self.SIMPLE_NEEDLE,
                          with_=self.SIMPLE_REPLACEMENT).in_(object())
예제 #42
0
파일: test_strings.py 프로젝트: Xion/taipan
 def test_replace__list(self):
     result = __unit__.replace(
         self.LIST_NEEDLE).with_(
         self.LIST_REPLACEMENT).in_(self.HAYSTACK)
     self.assertEquals(self.LIST_RESULT, result)
예제 #43
0
 def test_haystack__fluent__some_string(self):
     result = __unit__.replace(self.SIMPLE_NEEDLE,
                               with_=self.SIMPLE_REPLACEMENT).in_(
                                   self.HAYSTACK)
     self.assertEquals(self.SIMPLE_RESULT, result)
예제 #44
0
파일: test_strings.py 프로젝트: Xion/taipan
 def test_replace__mapping(self):
     result = __unit__.replace(self.MAP_REPLACEMENTS).in_(self.HAYSTACK)
     self.assertEquals(self.MAP_RESULT, result)
예제 #45
0
 def test_replace__simple(self):
     result = __unit__.replace(self.SIMPLE_NEEDLE).with_(
         self.SIMPLE_REPLACEMENT).in_(self.HAYSTACK)
     self.assertEquals(self.SIMPLE_RESULT, result)
예제 #46
0
 def test_needle__none(self):
     with self.assertRaises(TypeError) as r:
         __unit__.replace(None)
     self.assertIn("None", str(r.exception))
예제 #47
0
 def test_replace__mapping(self):
     result = __unit__.replace(self.MAP_REPLACEMENTS).in_(self.HAYSTACK)
     self.assertEquals(self.MAP_RESULT, result)
예제 #48
0
파일: test_strings.py 프로젝트: Xion/taipan
 def test_needle__none(self):
     with self.assertRaises(TypeError) as r:
         __unit__.replace(None)
     self.assertIn("None", str(r.exception))