コード例 #1
0
ファイル: test_osutils.py プロジェクト: pathscale/snakeoil
 def assertSame(self, val):
     self.assertEqual(
         osutils.native_join(*val),
         osutils.join(*val),
         msg="for %r, expected %r, got %r" % (
             val,
             osutils.native_join(*val),
             osutils.join(*val)))
コード例 #2
0
    def test_reimplementation_errors(self):
        # various type errors
        errors = [
            [],
            [1],
            ["foo", 1],
            ["foo", "/bar", []],
        ]

        for x in errors:
            with pytest.raises(TypeError):
                osutils.native_join(*x)
            with pytest.raises(TypeError):
                osutils.join(*x)
コード例 #3
0
ファイル: test_osutils.py プロジェクト: radhermit/snakeoil
    def test_reimplementation_errors(self):
        # various type errors
        errors = [
            [],
            [1],
            ["foo", 1],
            ["foo", "/bar", []],
        ]

        for x in errors:
            with pytest.raises(TypeError):
                osutils.native_join(*x)
            with pytest.raises(TypeError):
                osutils.join(*x)
コード例 #4
0
    def test_reimplementation(self):
        vals = [
            [""],
            ["foo"],
            ["", "foo"],
            ["foo", "dar"],
            ["foo", "/bar"],
            ["/bar", "dar"],
            ["/bar", "../dar"],
            ["", "../dar"],
            ["/bár", "dãr"],
            [b"/b\xc3\xa1r", b"d\xc3\xa3r"],
        ]

        for x in vals:
            assert osutils.native_join(*x) == osutils.join(*x), \
                "for %r, expected %r, got %r" % (
                    val, osutils.native_join(*x), osutils.join(*x))
コード例 #5
0
ファイル: test_osutils.py プロジェクト: radhermit/snakeoil
    def test_reimplementation(self):
        vals = [
            [""],
            ["foo"],
            ["", "foo"],
            ["foo", "dar"],
            ["foo", "/bar"],
            ["/bar", "dar"],
            ["/bar", "../dar"],
            ["", "../dar"],
            ["/bár", "dãr"],
            [b"/b\xc3\xa1r", b"d\xc3\xa3r"],
        ]

        for x in vals:
            assert osutils.native_join(*x) == osutils.join(*x), \
                "for %r, expected %r, got %r" % (
                    val, osutils.native_join(*x), osutils.join(*x))
コード例 #6
0
 def assertSame(self, val):
     self.assertEqual(osutils.native_join(*val),
                      osutils.join(*val),
                      msg="for %r, expected %r, got %r" %
                      (val, osutils.native_join(*val), osutils.join(*val)))