jaraco / jaraco/inflect

Broken ordinal cases

Open
#192 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
1.1k
Forks
127
PR merge metrics
No merged PRs in 30d

Description

Currently, there are two cases that are uncovered by the tests and produce potentially surprising results:

## float that's also an integer

```python
>>> ordinal(1.0)
'1.0st'
```

That's surprising because other float values produce the suffix based on the last digit of the float (e.g. "1.0th").

## float with no decimal digits

```python
>>> ordinal('1.')
'1.st'
```

Does "1.st" even make sense? The code does attempt to support this case, but I'm not at all confident it should.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at the ordinal() entry point and inspect the existing handling for float inputs and strings ending in a decimal point. Add focused tests for the two examples in the issue, then confirm the expected suffix behavior with the project’s test suite once the intended results for both cases are decided.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.