Skip to content

Store ints as ints in the configuration object#1119

Merged
codeboten merged 5 commits intoopen-telemetry:masterfrom
ocelotl:issue_1118
Sep 21, 2020
Merged

Store ints as ints in the configuration object#1119
codeboten merged 5 commits intoopen-telemetry:masterfrom
ocelotl:issue_1118

Conversation

@ocelotl
Copy link
Copy Markdown
Contributor

@ocelotl ocelotl commented Sep 16, 2020

Description

The configuration object currently stores "2" as "2.0". This change makes it store that value as "2".

Fixes #1118

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Updated test to specifically test this change.

  • test_integer

Checklist:

  • Followed the style guidelines of this project
  • Changelogs have been updated
  • Unit tests have been added
  • Documentation has been updated

@ocelotl ocelotl requested a review from a team September 16, 2020 07:37
@ocelotl ocelotl self-assigned this Sep 16, 2020
self.assertEqual(Configuration().POSITIVE_INTEGER, 123)
self.assertTrue(isinstance(Configuration().NEGATIVE_INTEGER, int))
self.assertEqual(Configuration().NEGATIVE_INTEGER, -123)
self.assertEqual(Configuration().NON_INTEGER, "-12z3")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Curious how these tests passed before this change

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Before, we didn't have tests that checked type (added them here with isinstance). And this:

Python 3.8.3 (default, Jun 29 2020, 18:03:36) 
Type 'copyright', 'credits' or 'license' for more information
IPython 7.16.1 -- An enhanced Interactive Python. Type '?' for help.

In [1]: 1 == 1.0
Out[1]: True

In [2]: 

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ahhhhh right, that makes sense now.

@ocelotl ocelotl requested a review from codeboten September 17, 2020 15:11
Copy link
Copy Markdown
Contributor

@codeboten codeboten left a comment

Choose a reason for hiding this comment

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

LGTM, just minor nits

@codeboten codeboten merged commit 99e8971 into open-telemetry:master Sep 21, 2020
alertedsnake pushed a commit to alertedsnake/opentelemetry-python that referenced this pull request Sep 25, 2020
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.

Configuration object stores ints as floats

3 participants