Skip to content

Handle parsing mandatory byte elements with no value#873

Merged
tefra merged 1 commit intotefra:mainfrom
SrirachaHorse:fix-872
Dec 8, 2023
Merged

Handle parsing mandatory byte elements with no value#873
tefra merged 1 commit intotefra:mainfrom
SrirachaHorse:fix-872

Conversation

@SrirachaHorse
Copy link
Contributor

@SrirachaHorse SrirachaHorse commented Dec 8, 2023

📒 Description

Fixes parsing of empty mandatory byte elements to produce a byte string instead of a unicode string.

Resolves #872

🔗 What I've Done

Adds special handling to the PrimitiveNode.bind() method if the incoming type is bytes.

💬 Comments

An alternative solution here might be to iterate through the list of incoming types (self.var.types) and attempt to construct a default value. However I'm not aware of any cases other than strings or bytes where this method would be called, so it may be overkill.

🛫 Checklist

@codecov
Copy link

codecov bot commented Dec 8, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (212ca4f) 99.89% compared to head (057b6ee) 99.89%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #873   +/-   ##
=======================================
  Coverage   99.89%   99.89%           
=======================================
  Files         105      105           
  Lines        9302     9304    +2     
  Branches     2078     2079    +1     
=======================================
+ Hits         9292     9294    +2     
  Misses          3        3           
  Partials        7        7           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Owner

@tefra tefra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great thank you!

@sonarqubecloud
Copy link

sonarqubecloud bot commented Dec 8, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@tefra tefra merged commit 7a27580 into tefra:main Dec 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Mandatory bytes with no default should return an empty byte string

2 participants