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)))
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)
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))
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)))