Update trade listings
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
import unittest
|
||||
|
||||
from extract_exchange_quotes import extract_quotes, parse_side
|
||||
|
||||
|
||||
class ExchangeQuoteTests(unittest.TestCase):
|
||||
def test_only_exact_variant_and_quantity(self):
|
||||
self.assertEqual(parse_side("my 2 Shiny Aizen Evo"),
|
||||
("Shiny Aizen Evo", 2, "my"))
|
||||
self.assertIsNone(parse_side("Shiny Aizen Evo + adds"))
|
||||
self.assertIsNone(parse_side("Aizen Evo or Homura Evo"))
|
||||
|
||||
def test_owner_direction_deduplication_and_ambiguous_listing(self):
|
||||
rows = [
|
||||
{"author_hash": "a", "offer": "Homura Evo | Dark Mage Evo",
|
||||
"lf": "Aizen Evo for my Homura Evo", "mlf": "", "nlf": ""},
|
||||
{"author_hash": "a", "offer": "Homura Evo",
|
||||
"lf": "Aizen Evo for my Homura Evo", "mlf": "", "nlf": ""},
|
||||
{"author_hash": "b", "offer": "Shiny Aizen Evo | Homura Evo",
|
||||
"lf": "Aizen Evo", "mlf": "", "nlf": ""},
|
||||
]
|
||||
quotes = extract_quotes(rows)
|
||||
self.assertEqual(len(quotes), 1)
|
||||
self.assertEqual(quotes[0]["offered_unit"], "Homura Evo")
|
||||
self.assertEqual(quotes[0]["requested_unit"], "Aizen Evo")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user