diff --git a/openc3/lib/openc3/tools/table_manager/table.rb b/openc3/lib/openc3/tools/table_manager/table.rb index f89ff6a74..f73ee26cc 100644 --- a/openc3/lib/openc3/tools/table_manager/table.rb +++ b/openc3/lib/openc3/tools/table_manager/table.rb @@ -44,6 +44,9 @@ class Table < Packet # Constructor for a TableDefinition def initialize(name, endianness, type, description, filename) super(TARGET, name, endianness, description, '', TableItem) + # ONE_DIMENSIONAL and TWO_DIMENSIONAL are deprecated so translate + type = :KEY_VALUE if type == :ONE_DIMENSIONAL + type = :ROW_COLUMN if type == :TWO_DIMENSIONAL if type != :KEY_VALUE && type != :ROW_COLUMN raise ArgumentError, "Invalid type '#{type}' for table '#{name}'. Must be KEY_VALUE or ROW_COLUMN" diff --git a/openc3/lib/openc3/tools/table_manager/table_parser.rb b/openc3/lib/openc3/tools/table_manager/table_parser.rb index b2a31732e..a357c70d4 100644 --- a/openc3/lib/openc3/tools/table_manager/table_parser.rb +++ b/openc3/lib/openc3/tools/table_manager/table_parser.rb @@ -57,10 +57,10 @@ def create_table(tables, warnings) end type = params[2].to_s.upcase.to_sym case type - when :KEY_VALUE + when :KEY_VALUE, :ONE_DIMENSIONAL # :ONE_DIMENSIONAL is deprecated @parser.verify_num_parameters(3, 4, @usage) description = params[3].to_s - when :ROW_COLUMN + when :ROW_COLUMN, :TWO_DIMENSIONAL # :TWO_DIMENSIONAL is deprecated @parser.verify_num_parameters(4, 5, @usage) num_rows = params[3].to_i description = params[4].to_s diff --git a/openc3/lib/openc3/topics/command_decom_topic.rb b/openc3/lib/openc3/topics/command_decom_topic.rb index d279041b3..674ed9651 100644 --- a/openc3/lib/openc3/topics/command_decom_topic.rb +++ b/openc3/lib/openc3/topics/command_decom_topic.rb @@ -47,13 +47,6 @@ def self.write_packet(packet, scope:) def self.get_cmd_item(target_name, packet_name, param_name, type: :WITH_UNITS, scope: $openc3_scope) msg_id, msg_hash = Topic.get_newest_message("#{scope}__DECOMCMD__{#{target_name}}__#{packet_name}") if msg_id - # TODO: We now have these reserved items directly on command packets - # Do we still calculate from msg_hash['time'] or use the times directly? - # - # if param_name == 'RECEIVED_TIMESECONDS' || param_name == 'PACKET_TIMESECONDS' - # Time.from_nsec_from_epoch(msg_hash['time'].to_i).to_f - # elsif param_name == 'RECEIVED_TIMEFORMATTED' || param_name == 'PACKET_TIMEFORMATTED' - # Time.from_nsec_from_epoch(msg_hash['time'].to_i).formatted if param_name == 'RECEIVED_COUNT' msg_hash['received_count'].to_i else diff --git a/openc3/python/openc3/models/target_model.py b/openc3/python/openc3/models/target_model.py index 0c1d46a6a..d77cb0bd9 100644 --- a/openc3/python/openc3/models/target_model.py +++ b/openc3/python/openc3/models/target_model.py @@ -189,7 +189,6 @@ def build_item_to_packet_map(cls, target_name: str, scope: str = OPENC3_SCOPE): item_map[item_name].append(packet["packet_name"]) return item_map - # TODO: Not nearly complete ... see target_model.rb def __init__( self, name: str, diff --git a/openc3/python/openc3/packets/commands.py b/openc3/python/openc3/packets/commands.py index 913a18194..2ddb1890d 100644 --- a/openc3/python/openc3/packets/commands.py +++ b/openc3/python/openc3/packets/commands.py @@ -204,8 +204,10 @@ def build_cmd_output_string(self, target_name, cmd_name, cmd_params, raw=False): if cmd_params is None or len(cmd_params) == 0: output_string += '")' else: - # TODO: Try except around this? - command_items = self.packet(target_name, cmd_name).items + try: + command_items = self.packet(target_name, cmd_name).items + except RuntimeError: + command_items = {} params = [] for key, value in cmd_params: diff --git a/openc3/python/openc3/topics/command_decom_topic.py b/openc3/python/openc3/topics/command_decom_topic.py index 73ff5657c..2b297a0c5 100644 --- a/openc3/python/openc3/topics/command_decom_topic.py +++ b/openc3/python/openc3/topics/command_decom_topic.py @@ -54,13 +54,6 @@ def write_packet(cls, packet, scope): def get_cmd_item(cls, target_name, packet_name, param_name, type="WITH_UNITS", scope=OPENC3_SCOPE): msg_id, msg_hash = Topic.get_newest_message(f"{scope}__DECOMCMD__{{{target_name}}}__{packet_name}") if msg_id: - # TODO: We now have these reserved items directly on command packets - # Do we still calculate from msg_hash['time'] or use the times directly? - # - # if param_name == 'RECEIVED_TIMESECONDS' || param_name == 'PACKET_TIMESECONDS' - # Time.from_nsec_from_epoch(msg_hash['time'].to_i).to_f - # elsif param_name == 'RECEIVED_TIMEFORMATTED' || param_name == 'PACKET_TIMEFORMATTED' - # Time.from_nsec_from_epoch(msg_hash['time'].to_i).formatted if param_name == "RECEIVED_COUNT": return int(msg_hash[b"received_count"]) else: diff --git a/openc3/python/test/accessors/test_binary_accessor_read.py b/openc3/python/test/accessors/test_binary_accessor_read.py index 77e1f4faf..c8dfd5528 100644 --- a/openc3/python/test/accessors/test_binary_accessor_read.py +++ b/openc3/python/test/accessors/test_binary_accessor_read.py @@ -25,104 +25,52 @@ def setUp(self): self.data = b"\x80\x81\x82\x83\x84\x85\x86\x87\x00\x09\x0A\x0B\x0C\x0D\x0E\x0F" def test_complains_about_unknown_data_types(self): - self.assertRaisesRegex( - AttributeError, - "data_type BLOB is not recognized", - BinaryAccessor.read, - 0, - 32, - "BLOB", - self.data, - "BIG_ENDIAN", - ) + with self.assertRaisesRegex(AttributeError, "data_type BLOB is not recognized"): + BinaryAccessor.read(0, 32, "BLOB", self.data, "BIG_ENDIAN") def test_complains_about_bit_offsets_before_the_beginning_of_the_buffer(self): - self.assertRaisesRegex( + with self.assertRaisesRegex( AttributeError, f"{len(self.data)} byte buffer insufficient to read STRING at bit_offset {-((len(self.data) * 8) + 8)} with bit_size 32", - BinaryAccessor.read, - -(len(self.data) * 8 + 8), - 32, - "STRING", - self.data, - "BIG_ENDIAN", - ) + ): + BinaryAccessor.read(-(len(self.data) * 8 + 8), 32, "STRING", self.data, "BIG_ENDIAN") def test_complains_about_a_negative_bit_offset_and_zero_bit_size(self): - self.assertRaisesRegex( - AttributeError, - r"negative or zero bit_sizes \(0\) cannot be given with negative bit_offsets \(-8\)", - BinaryAccessor.read, - -8, - 0, - "STRING", - self.data, - "BIG_ENDIAN", - ) + with self.assertRaisesRegex( + AttributeError, r"negative or zero bit_sizes \(0\) cannot be given with negative bit_offsets \(-8\)" + ): + BinaryAccessor.read(-8, 0, "STRING", self.data, "BIG_ENDIAN") def test_complains_about_a_negative_bit_offset_and_negative_bit_size(self): - self.assertRaisesRegex( - AttributeError, - r"negative or zero bit_sizes \(-8\) cannot be given with negative bit_offsets \(-8\)", - BinaryAccessor.read, - -8, - -8, - "STRING", - self.data, - "BIG_ENDIAN", - ) + with self.assertRaisesRegex( + AttributeError, r"negative or zero bit_sizes \(-8\) cannot be given with negative bit_offsets \(-8\)" + ): + BinaryAccessor.read(-8, -8, "STRING", self.data, "BIG_ENDIAN") def test_complains_about_negative_bit_sizes_larger_than_the_size_of_the_buffer( self, ): - self.assertRaisesRegex( + with self.assertRaisesRegex( AttributeError, - # TODO: WHat's up with this not matching f"{len(self.data)} byte buffer insufficient to read STRING at bit_offset 0 with bit_size {-((len(self.data) * 8) + 8)}", - BinaryAccessor.read, - 0, - -((len(self.data) * 8) + 8), - "STRING", - self.data, - "BIG_ENDIAN", - ) + ): + BinaryAccessor.read(0, -((len(self.data) * 8) + 8), "STRING", self.data, "BIG_ENDIAN") def test_complains_about_negative_or_zero_bit_sizes_with_data_types_other_than_string_and_block( self, ): - self.assertRaisesRegex( - AttributeError, - # TODO: WHat's up with this not matching - "bit_size -8 must be positive for data types other than 'STRING' and 'BLOCK'", - BinaryAccessor.read, - 0, - -8, - "INT", - self.data, - "BIG_ENDIAN", - ) - self.assertRaisesRegex( - AttributeError, - # TODO: WHat's up with this not matching - "bit_size -8 must be positive for data types other than 'STRING' and 'BLOCK'", - BinaryAccessor.read, - 0, - -8, - "UINT", - self.data, - "BIG_ENDIAN", - ) - self.assertRaisesRegex( - AttributeError, - # TODO: WHat's up with this not matching - "bit_size -8 must be positive for data types other than 'STRING' and 'BLOCK'", - BinaryAccessor.read, - 0, - -8, - "FLOAT", - self.data, - "BIG_ENDIAN", - ) + with self.assertRaisesRegex( + AttributeError, "bit_size -8 must be positive for data types other than 'STRING' and 'BLOCK'" + ): + BinaryAccessor.read(0, -8, "INT", self.data, "BIG_ENDIAN") + with self.assertRaisesRegex( + AttributeError, "bit_size -8 must be positive for data types other than 'STRING' and 'BLOCK'" + ): + BinaryAccessor.read(0, -8, "UINT", self.data, "BIG_ENDIAN") + with self.assertRaisesRegex( + AttributeError, "bit_size -8 must be positive for data types other than 'STRING' and 'BLOCK'" + ): + BinaryAccessor.read(0, -8, "FLOAT", self.data, "BIG_ENDIAN") def test_reads_ascii_strings(self): self.data = "DEADBEEF".encode() @@ -196,16 +144,8 @@ def test_reads_strings_with_negative_bit_offsets(self): ) def test_complains_about_unaligned_strings(self): - self.assertRaisesRegex( - AttributeError, - "bit_offset 1 is not byte aligned for data_type STRING", - BinaryAccessor.read, - 1, - 32, - "STRING", - self.data, - "BIG_ENDIAN", - ) + with self.assertRaisesRegex(AttributeError, "bit_offset 1 is not byte aligned for data_type STRING"): + BinaryAccessor.read(1, 32, "STRING", self.data, "BIG_ENDIAN") def test_reads_aligned_blocks(self): for bit_offset in range(0, (len(self.data) - 1) * 8, 8): @@ -234,28 +174,14 @@ def test_reads_blocks_with_negative_bit_offsets(self): ) def test_complains_about_unaligned_blocks(self): - self.assertRaisesRegex( - AttributeError, - "bit_offset 7 is not byte aligned for data_type BLOCK", - BinaryAccessor.read, - 7, - 16, - "BLOCK", - self.data, - "BIG_ENDIAN", - ) + with self.assertRaisesRegex(AttributeError, "bit_offset 7 is not byte aligned for data_type BLOCK"): + BinaryAccessor.read(7, 16, "BLOCK", self.data, "BIG_ENDIAN") def test_complains_if_read_exceeds_the_size_of_the_buffer(self): - self.assertRaisesRegex( - AttributeError, - "16 byte buffer insufficient to read STRING at bit_offset 8 with bit_size 800", - BinaryAccessor.read, - 8, - 800, - "STRING", - self.data, - "BIG_ENDIAN", - ) + with self.assertRaisesRegex( + AttributeError, "16 byte buffer insufficient to read STRING at bit_offset 8 with bit_size 800" + ): + BinaryAccessor.read(8, 800, "STRING", self.data, "BIG_ENDIAN") def test_reads_aligned_8_bit_unsigned_integers(self): for bit_offset in range(0, (len(self.data) - 1) * 8, 8): @@ -556,28 +482,12 @@ def test_reads_aligned_64_bit_floats(self): ) def test_complains_about_unaligned_floats(self): - self.assertRaisesRegex( - AttributeError, - "bit_offset 17 is not byte aligned for data_type FLOAT", - BinaryAccessor.read, - 17, - 32, - "FLOAT", - self.data, - "BIG_ENDIAN", - ) + with self.assertRaisesRegex(AttributeError, "bit_offset 17 is not byte aligned for data_type FLOAT"): + BinaryAccessor.read(17, 32, "FLOAT", self.data, "BIG_ENDIAN") def test_complains_about_mis_sized_floats(self): - self.assertRaisesRegex( - AttributeError, - "bit_size is 33 but must be 32 or 64 for data_type FLOAT", - BinaryAccessor.read, - 0, - 33, - "FLOAT", - self.data, - "BIG_ENDIAN", - ) + with self.assertRaisesRegex(AttributeError, "bit_size is 33 but must be 32 or 64 for data_type FLOAT"): + BinaryAccessor.read(0, 33, "FLOAT", self.data, "BIG_ENDIAN") class TestBinaryAccessorReadLittleEndian(unittest.TestCase): @@ -585,16 +495,10 @@ def setUp(self): self.data = b"\x80\x81\x82\x83\x84\x85\x86\x87\x00\x09\x0A\x0B\x0C\x0D\x0E\x0F" def test_complains_about_ill_defined_little_endian_bitfields(self): - self.assertRaisesRegex( - AttributeError, - "LITTLE_ENDIAN bitfield with bit_offset 3 and bit_size 7 is invalid", - BinaryAccessor.read, - 3, - 7, - "UINT", - self.data, - "LITTLE_ENDIAN", - ) + with self.assertRaisesRegex( + AttributeError, "LITTLE_ENDIAN bitfield with bit_offset 3 and bit_size 7 is invalid" + ): + BinaryAccessor.read(3, 7, "UINT", self.data, "LITTLE_ENDIAN") def test_reads_1_bit_unsigned_integers(self): expected = [0x1, 0x0] @@ -826,9 +730,7 @@ def test_reads_67_bit_signed_integers(self): if value >= 2 ** (bit_size - 1): expected[index] = value - 2**bit_size self.assertEqual( - BinaryAccessor.read( - 120, bit_size, "INT", self.data, "LITTLE_ENDIAN" - ), + BinaryAccessor.read(120, bit_size, "INT", self.data, "LITTLE_ENDIAN"), expected[0], ) @@ -867,28 +769,12 @@ def test_reads_aligned_64_bit_floats(self): ) def test_complains_about_unaligned_floats(self): - self.assertRaisesRegex( - AttributeError, - "bit_offset 1 is not byte aligned for data_type FLOAT", - BinaryAccessor.read, - 1, - 32, - "FLOAT", - self.data, - "LITTLE_ENDIAN", - ) + with self.assertRaisesRegex(AttributeError, "bit_offset 1 is not byte aligned for data_type FLOAT"): + BinaryAccessor.read(1, 32, "FLOAT", self.data, "LITTLE_ENDIAN") def test_complains_about_mis_sized_floats(self): - self.assertRaisesRegex( - AttributeError, - "bit_size is 65 but must be 32 or 64 for data_type FLOAT", - BinaryAccessor.read, - 0, - 65, - "FLOAT", - self.data, - "LITTLE_ENDIAN", - ) + with self.assertRaisesRegex(AttributeError, "bit_size is 65 but must be 32 or 64 for data_type FLOAT"): + BinaryAccessor.read(0, 65, "FLOAT", self.data, "LITTLE_ENDIAN") class TestBinaryAccessorReadArrayLE(unittest.TestCase): @@ -900,12 +786,8 @@ def test_complains_with_unknown_data_type(self): BinaryAccessor.read_array(0, 8, "BLAH", 0, self.data, "LITTLE_ENDIAN") def test_complains_about_negative_bit_sizes(self): - with self.assertRaisesRegex( - AttributeError, "bit_size -8 must be positive for arrays" - ): - BinaryAccessor.read_array( - 0, -8, "UINT", len(self.data) * 8, self.data, "LITTLE_ENDIAN" - ) + with self.assertRaisesRegex(AttributeError, "bit_size -8 must be positive for arrays"): + BinaryAccessor.read_array(0, -8, "UINT", len(self.data) * 8, self.data, "LITTLE_ENDIAN") def test_reads_the_given_array_size_amount_of_items(self): self.assertEqual( @@ -922,16 +804,12 @@ def test_reads_the_given_array_size_amount_of_items2(self): def test_reads_the_total_buffer_given_array_size_eql_buffer_size(self): data = [(x & ~(1 << 7)) - (x & (1 << 7)) for x in self.data] self.assertEqual( - BinaryAccessor.read_array( - 0, 8, "INT", len(self.data) * 8, self.data, "LITTLE_ENDIAN" - ), + BinaryAccessor.read_array(0, 8, "INT", len(self.data) * 8, self.data, "LITTLE_ENDIAN"), data, ) def test_complains_with_an_array_size_not_a_multiple_of_bit_size(self): - with self.assertRaisesRegex( - AttributeError, "array_size 10 not a multiple of bit_size 8" - ): + with self.assertRaisesRegex(AttributeError, "array_size 10 not a multiple of bit_size 8"): BinaryAccessor.read_array(0, 8, "UINT", 10, self.data, "LITTLE_ENDIAN") def test_reads_as_many_items_as_possible_with_a_zero_array_size(self): @@ -948,9 +826,7 @@ def test_excludes_the_remaining_bits_if_array_size_is_negative(self): def test_returns_an_empty_array_if_the_offset_equals_the_negative_array_size(self): self.assertEqual( - BinaryAccessor.read_array( - len(self.data) * 8 - 32, 8, "UINT", -32, self.data, "LITTLE_ENDIAN" - ), + BinaryAccessor.read_array(len(self.data) * 8 - 32, 8, "UINT", -32, self.data, "LITTLE_ENDIAN"), [], ) @@ -960,9 +836,7 @@ def test_complains_if_the_offset_is_greater_than_the_negative_array_size(self): AttributeError, f"16 byte buffer insufficient to read UINT at bit_offset {offset} with bit_size 8", ): - BinaryAccessor.read_array( - offset, 8, "UINT", -32, self.data, "LITTLE_ENDIAN" - ) + BinaryAccessor.read_array(offset, 8, "UINT", -32, self.data, "LITTLE_ENDIAN") def test_reads_an_array_of_aligned_8_bit_unsigned_integers(self): self.assertEqual( @@ -1019,14 +893,10 @@ def test_complains_about_accessing_data_from_a_buffer_which_is_too_small(self): BinaryAccessor.read_array(0, 256, "STRING", 256, self.data, "LITTLE_ENDIAN") def test_returns_an_empty_array_when_passed_a_zero_length_buffer(self): - self.assertEqual( - BinaryAccessor.read_array(0, 8, "UINT", 32, b"", "LITTLE_ENDIAN"), [] - ) + self.assertEqual(BinaryAccessor.read_array(0, 8, "UINT", 32, b"", "LITTLE_ENDIAN"), []) def test_complains_about_unaligned_strings(self): - with self.assertRaisesRegex( - AttributeError, "bit_offset 1 is not byte aligned for data_type STRING" - ): + with self.assertRaisesRegex(AttributeError, "bit_offset 1 is not byte aligned for data_type STRING"): BinaryAccessor.read_array(1, 32, "STRING", 32, self.data, "LITTLE_ENDIAN") def test_reads_a_single_string_item(self): @@ -1076,9 +946,7 @@ def test_reads_16_bit_uint_items(self): def test_reads_16_bit_int_items(self): data = [0x8180, 0x8382, 0x8584, 0x8786, 0x0900, 0x0B0A, 0x0D0C, 0x0F0E] data = [(x & ~(1 << 15)) - (x & (1 << 15)) for x in data] - self.assertEqual( - BinaryAccessor.read_array(0, 16, "INT", 0, self.data, "LITTLE_ENDIAN"), data - ) + self.assertEqual(BinaryAccessor.read_array(0, 16, "INT", 0, self.data, "LITTLE_ENDIAN"), data) def test_reads_32_bit_uint_items(self): data = [0x83828180, 0x87868584, 0x0B0A0900, 0x0F0E0D0C] @@ -1090,9 +958,7 @@ def test_reads_32_bit_uint_items(self): def test_reads_32_bit_int_items(self): data = [0x83828180, 0x87868584, 0x0B0A0900, 0x0F0E0D0C] data = [(x & ~(1 << 31)) - (x & (1 << 31)) for x in data] - self.assertEqual( - BinaryAccessor.read_array(0, 32, "INT", 0, self.data, "LITTLE_ENDIAN"), data - ) + self.assertEqual(BinaryAccessor.read_array(0, 32, "INT", 0, self.data, "LITTLE_ENDIAN"), data) def test_reads_64_bit_uint_items(self): data = [0x8786858483828180, 0x0F0E0D0C0B0A0900] @@ -1104,36 +970,26 @@ def test_reads_64_bit_uint_items(self): def test_reads_64_bit_int_items(self): data = [0x8786858483828180, 0x0F0E0D0C0B0A0900] data = [(x & ~(1 << 63)) - (x & (1 << 63)) for x in data] - self.assertEqual( - BinaryAccessor.read_array(0, 64, "INT", 0, self.data, "LITTLE_ENDIAN"), data - ) + self.assertEqual(BinaryAccessor.read_array(0, 64, "INT", 0, self.data, "LITTLE_ENDIAN"), data) def test_reads_aligned_32_bit_floats(self): expected_array = [-7.670445e-037, -2.024055e-034, 2.658460e-032, 7.003653e-030] - actual = BinaryAccessor.read_array( - 0, 32, "FLOAT", 0, self.data, "LITTLE_ENDIAN" - ) + actual = BinaryAccessor.read_array(0, 32, "FLOAT", 0, self.data, "LITTLE_ENDIAN") for index, val in enumerate(actual): self.assertAlmostEqual(val, expected_array[index]) def test_reads_aligned_64_bit_floats(self): expected_array = [-2.081577e-272, 3.691916e-236] - actual = BinaryAccessor.read_array( - 0, 64, "FLOAT", 0, self.data, "LITTLE_ENDIAN" - ) + actual = BinaryAccessor.read_array(0, 64, "FLOAT", 0, self.data, "LITTLE_ENDIAN") for index, val in enumerate(actual): self.assertAlmostEqual(val, expected_array[index]) def test_complains_about_unaligned_floats(self): - with self.assertRaisesRegex( - AttributeError, "bit_offset 1 is not byte aligned for data_type FLOAT" - ): + with self.assertRaisesRegex(AttributeError, "bit_offset 1 is not byte aligned for data_type FLOAT"): BinaryAccessor.read_array(1, 32, "FLOAT", 32, self.data, "LITTLE_ENDIAN") def test_complains_about_mis_sized_floats(self): - with self.assertRaisesRegex( - AttributeError, "bit_size is 65 but must be 32 or 64 for data_type FLOAT" - ): + with self.assertRaisesRegex(AttributeError, "bit_size is 65 but must be 32 or 64 for data_type FLOAT"): BinaryAccessor.read_array(0, 65, "FLOAT", 65, self.data, "LITTLE_ENDIAN") @@ -1157,35 +1013,25 @@ def test_reads_16_bit_uint_items(self): def test_reads_16_bit_int_items(self): data = [0x8081, 0x8283, 0x8485, 0x8687, 0x0009, 0x0A0B, 0x0C0D, 0x0E0F] data = [(x & ~(1 << 15)) - (x & (1 << 15)) for x in data] - self.assertEqual( - BinaryAccessor.read_array(0, 16, "INT", 0, self.data, "BIG_ENDIAN"), data - ) + self.assertEqual(BinaryAccessor.read_array(0, 16, "INT", 0, self.data, "BIG_ENDIAN"), data) def test_reads_32_bit_uint_items(self): data = [0x80818283, 0x84858687, 0x00090A0B, 0x0C0D0E0F] - self.assertEqual( - BinaryAccessor.read_array(0, 32, "UINT", 0, self.data, "BIG_ENDIAN"), data - ) + self.assertEqual(BinaryAccessor.read_array(0, 32, "UINT", 0, self.data, "BIG_ENDIAN"), data) def test_reads_32_bit_int_items(self): data = [0x80818283, 0x84858687, 0x00090A0B, 0x0C0D0E0F] data = [(x & ~(1 << 31)) - (x & (1 << 31)) for x in data] - self.assertEqual( - BinaryAccessor.read_array(0, 32, "INT", 0, self.data, "BIG_ENDIAN"), data - ) + self.assertEqual(BinaryAccessor.read_array(0, 32, "INT", 0, self.data, "BIG_ENDIAN"), data) def test_reads_64_bit_uint_items(self): data = [0x8081828384858687, 0x00090A0B0C0D0E0F] - self.assertEqual( - BinaryAccessor.read_array(0, 64, "UINT", 0, self.data, "BIG_ENDIAN"), data - ) + self.assertEqual(BinaryAccessor.read_array(0, 64, "UINT", 0, self.data, "BIG_ENDIAN"), data) def test_reads_64_bit_int_items(self): data = [0x8081828384858687, 0x00090A0B0C0D0E0F] data = [(x & ~(1 << 63)) - (x & (1 << 63)) for x in data] - self.assertEqual( - BinaryAccessor.read_array(0, 64, "INT", 0, self.data, "BIG_ENDIAN"), data - ) + self.assertEqual(BinaryAccessor.read_array(0, 64, "INT", 0, self.data, "BIG_ENDIAN"), data) def test_reads_aligned_32_bit_floats(self): expected_array = [-1.189360e-038, -3.139169e-036, 8.301067e-040, 1.086646e-031] diff --git a/openc3/python/test/interfaces/test_interface.py b/openc3/python/test/interfaces/test_interface.py index d7fabf991..f02a404a2 100644 --- a/openc3/python/test/interfaces/test_interface.py +++ b/openc3/python/test/interfaces/test_interface.py @@ -404,7 +404,6 @@ def write_interface(self, data, extra=None): interface = MyInterface() start_time = time.time() - threads = [] for x in range(10): thread = threading.Thread( target=interface.write, diff --git a/openc3/python/test/test_json_rpc_error.py b/openc3/python/test/test_json_rpc_error.py index 6184494bf..2092f333d 100644 --- a/openc3/python/test/test_json_rpc_error.py +++ b/openc3/python/test/test_json_rpc_error.py @@ -34,7 +34,7 @@ def test_bad_error(self): Test json request """ json_request_example = {"message": "foobar", "data": {}} - with self.assertRaises(KeyError) as context: + with self.assertRaises(KeyError): JsonRpcError.from_hash(json_request_example)