Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Hypothesis tests for TradeCodes #71

Merged

Conversation

CyberiaResurrection
Copy link
Contributor

This PR hooks up the Hypothesis testing library, which enables property-based tests:

  1. For all data matching some specification.
  2. Perform some operations on the data.
  3. Assert something about the result.

Starline parsing has historically been less than robust, and trade code parsing was no better than the rest of it, so this PR started there.

The specification i used was Given an otherwise-valid input string, it should parse cleanly to a well-formed TradeCodes object that then should cleanly round-trip to/from string. As could be expected, smoke poured out of TradeCode parsing. So I went thru and fixed that.

@CyberiaResurrection CyberiaResurrection force-pushed the AddHypothesisTests-TradeCode branch from eaefc8d to d87f9d4 Compare November 10, 2023 09:59
@CyberiaResurrection CyberiaResurrection force-pushed the AddHypothesisTests-TradeCode branch from c8ab8cc to 9010d5b Compare November 11, 2023 06:58
Copy link
Contributor

@tjoneslo tjoneslo left a comment

Choose a reason for hiding this comment

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

A few comments and some suggestions for improvements.

PyRoute/Star.py Outdated Show resolved Hide resolved
PyRoute/TradeCodes.py Show resolved Hide resolved
PyRoute/TradeCodes.py Outdated Show resolved Hide resolved
PyRoute/TradeCodes.py Show resolved Hide resolved
PyRoute/TradeCodes.py Outdated Show resolved Hide resolved
Tests/testDeltaStar.py Outdated Show resolved Hide resolved
PyRoute/StatCalculation.py Outdated Show resolved Hide resolved
@CyberiaResurrection CyberiaResurrection force-pushed the AddHypothesisTests-TradeCode branch from c233658 to fbf8141 Compare November 11, 2023 19:00
PyRoute/TradeCodes.py Outdated Show resolved Hide resolved
PyRoute/TradeCodes.py Outdated Show resolved Hide resolved
PyRoute/TradeCodes.py Show resolved Hide resolved
@CyberiaResurrection CyberiaResurrection force-pushed the AddHypothesisTests-TradeCode branch from abd6673 to 2285861 Compare November 14, 2023 04:44
@CyberiaResurrection CyberiaResurrection force-pushed the AddHypothesisTests-TradeCode branch 4 times, most recently from 9d8b599 to c9591fc Compare November 15, 2023 11:15
@CyberiaResurrection CyberiaResurrection force-pushed the AddHypothesisTests-TradeCode branch from c9591fc to da77572 Compare November 15, 2023 12:00
@CyberiaResurrection CyberiaResurrection force-pushed the AddHypothesisTests-TradeCode branch from da77572 to 12bb779 Compare November 15, 2023 12:31
Copy link
Contributor

@tjoneslo tjoneslo left a comment

Choose a reason for hiding this comment

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

Let's get this merged in. I'm concerned with the _process_sophonts_and_homeworlds() being a hand-written parser and therefore fragile. But let's fix that in the next pass.

@tjoneslo tjoneslo merged commit 8a672f9 into makhidkarun:master Nov 19, 2023
1 check passed
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.

2 participants