コード例 #1
0
ファイル: test_strings.py プロジェクト: movermeyer/taipan
 def test_replacement__omitted(self):
     replacer = __unit__.replace(self.SIMPLE_NEEDLE)
     self._assertReplacer(replacer, [self.SIMPLE_NEEDLE])
コード例 #2
0
ファイル: test_strings.py プロジェクト: movermeyer/taipan
 def test_needle__empty_iterable(self):
     with self.assertRaises(ValueError) as r:
         __unit__.replace([])
     self.assertIn("empty", str(r.exception))
コード例 #3
0
ファイル: test_strings.py プロジェクト: movermeyer/taipan
 def test_needle__list(self):
     replacer = __unit__.replace(self.LIST_NEEDLE)
     self._assertReplacer(replacer, self.LIST_NEEDLE)
コード例 #4
0
ファイル: test_strings.py プロジェクト: movermeyer/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)
コード例 #5
0
ファイル: test_strings.py プロジェクト: Xion/taipan
 def test_needle__non_string(self):
     with self.assertRaises(TypeError):
         __unit__.replace(object())
コード例 #6
0
ファイル: test_strings.py プロジェクト: movermeyer/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})
コード例 #7
0
ファイル: test_strings.py プロジェクト: movermeyer/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))
コード例 #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
ファイル: test_strings.py プロジェクト: movermeyer/taipan
 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
ファイル: test_strings.py プロジェクト: movermeyer/taipan
 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
ファイル: test_strings.py プロジェクト: movermeyer/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})
コード例 #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
ファイル: test_strings.py プロジェクト: movermeyer/taipan
 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
ファイル: test_strings.py プロジェクト: movermeyer/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)
コード例 #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
ファイル: test_strings.py プロジェクト: movermeyer/taipan
 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
ファイル: test_strings.py プロジェクト: movermeyer/taipan
 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
ファイル: test_strings.py プロジェクト: movermeyer/taipan
 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
ファイル: test_strings.py プロジェクト: movermeyer/taipan
 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
ファイル: test_strings.py プロジェクト: movermeyer/taipan
 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
ファイル: test_strings.py プロジェクト: movermeyer/taipan
 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
ファイル: test_strings.py プロジェクト: movermeyer/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)
コード例 #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
ファイル: test_strings.py プロジェクト: movermeyer/taipan
 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
ファイル: test_strings.py プロジェクト: movermeyer/taipan
 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
ファイル: test_strings.py プロジェクト: movermeyer/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)
コード例 #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
ファイル: test_strings.py プロジェクト: movermeyer/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)
コード例 #46
0
ファイル: test_strings.py プロジェクト: movermeyer/taipan
 def test_needle__none(self):
     with self.assertRaises(TypeError) as r:
         __unit__.replace(None)
     self.assertIn("None", str(r.exception))
コード例 #47
0
ファイル: test_strings.py プロジェクト: movermeyer/taipan
 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))