Debian Codegraph @

test/unit/test_compatibility.py

raw symbols SCIP
1 # pyOCD debugger
2 # Copyright (c) 2019-2020 Arm Limited
3 # SPDX-License-Identifier: Apache-2.0
4 #
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
8 #
9 # http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16
17 from pyocd.utility.compatibility import (
18 to_bytes_safe,
19 to_str_safe,
20 )
21
22 class TestCompatibility(object):
23 def test_to_bytes_safe(self):
24 assert to_bytes_safe(b"hello") == b"hello"
25 assert to_bytes_safe("string") == b"string"
26
27 def test_to_str_safe(self):
28 assert to_str_safe(b"bytes") == "bytes"
29 assert to_str_safe("string") == "string"
30 assert to_str_safe('System Administrator\u2019s Mouse') == 'System Administrator\u2019s Mouse'