Skip to content

Commit ca73df1

Browse files
mattsb42-awspraus
authored andcommitted
add unit test for _sorted_key_map
1 parent 0e4e4a4 commit ca73df1

File tree

3 files changed

+71
-0
lines changed

3 files changed

+71
-0
lines changed

test/unit/internal/__init__.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License"). You
4+
# may not use this file except in compliance with the License. A copy of
5+
# the License is located at
6+
#
7+
# http://aws.amazon.com/apache2.0/
8+
#
9+
# or in the "license" file accompanying this file. This file is
10+
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
11+
# ANY KIND, either express or implied. See the License for the specific
12+
# language governing permissions and limitations under the License.
13+
"""Dummy stub to make linters work better."""
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License"). You
4+
# may not use this file except in compliance with the License. A copy of
5+
# the License is located at
6+
#
7+
# http://aws.amazon.com/apache2.0/
8+
#
9+
# or in the "license" file accompanying this file. This file is
10+
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
11+
# ANY KIND, either express or implied. See the License for the specific
12+
# language governing permissions and limitations under the License.
13+
"""Dummy stub to make linters work better."""
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License"). You
4+
# may not use this file except in compliance with the License. A copy of
5+
# the License is located at
6+
#
7+
# http://aws.amazon.com/apache2.0/
8+
#
9+
# or in the "license" file accompanying this file. This file is
10+
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
11+
# ANY KIND, either express or implied. See the License for the specific
12+
# language governing permissions and limitations under the License.
13+
"""Unit tests for ``dynamodb_encryption_sdk.internal.formatting.serialize.attribute``
14+
and ``dynamodb_encryption_sdk.internal.formatting.deserialize.attribute``."""
15+
import pytest
16+
17+
from dynamodb_encryption_sdk.internal.formatting.serialize.attribute import _sorted_key_map
18+
from dynamodb_encryption_sdk.internal.str_ops import to_bytes
19+
20+
pytestmark = [pytest.mark.unit, pytest.mark.local]
21+
22+
23+
@pytest.mark.parametrize('initial, expected, transform', (
24+
(
25+
{
26+
'test': 'value',
27+
'zzz': 'another',
28+
'aaa': 'qqq',
29+
'?>?>?': 5,
30+
b'\x00\x00': None
31+
},
32+
[
33+
(b'\x00\x00', None, b'\x00\x00'),
34+
(b'?>?>?', 5, '?>?>?'),
35+
(b'aaa', 'qqq', 'aaa'),
36+
(b'test', 'value', 'test'),
37+
(b'zzz', 'another', 'zzz')
38+
],
39+
to_bytes
40+
),
41+
))
42+
def test_sorted_key_map(initial, expected, transform):
43+
actual = _sorted_key_map(initial, transform)
44+
45+
assert actual == expected

0 commit comments

Comments
 (0)