2019-12-08 22:43:49 +01:00
|
|
|
# vim: set fileencoding=utf-8
|
|
|
|
import unittest
|
|
|
|
|
|
|
|
from bemani.common import ID
|
|
|
|
|
|
|
|
|
|
|
|
class TestID(unittest.TestCase):
|
|
|
|
def test_format_extid(self) -> None:
|
2022-10-15 20:56:30 +02:00
|
|
|
self.assertEqual(ID.format_extid(12345678), "1234-5678")
|
|
|
|
self.assertEqual(ID.parse_extid("1234-5678"), 12345678)
|
|
|
|
self.assertEqual(ID.parse_extid("bla"), None)
|
|
|
|
self.assertEqual(ID.parse_extid("blah-blah"), None)
|
2019-12-08 22:43:49 +01:00
|
|
|
|
|
|
|
def test_format_machine_id(self) -> None:
|
2022-10-15 20:56:30 +02:00
|
|
|
self.assertEqual(ID.format_machine_id(123), "US-123")
|
|
|
|
self.assertEqual(ID.parse_machine_id("US-123"), 123)
|
|
|
|
self.assertEqual(ID.parse_machine_id("bla"), None)
|
|
|
|
self.assertEqual(ID.parse_machine_id("US-blah"), None)
|