Rename superchat calculator
This commit is contained in:
@@ -14,7 +14,7 @@ items_sticker = [
|
|||||||
'item',
|
'item',
|
||||||
'liveChatPaidStickerRenderer'
|
'liveChatPaidStickerRenderer'
|
||||||
]
|
]
|
||||||
class Calculator(ChatProcessor):
|
class SuperchatCalculator(ChatProcessor):
|
||||||
"""
|
"""
|
||||||
Calculate the amount of SuperChat by currency.
|
Calculate the amount of SuperChat by currency.
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
from pytchat.processors.superchat.calculator import Calculator
|
from pytchat.processors.superchat.calculator import SuperchatCalculator
|
||||||
|
|
||||||
get_item = Calculator()._get_item
|
get_item = SuperchatCalculator()._get_item
|
||||||
|
|
||||||
dict_test = {
|
dict_test = {
|
||||||
'root':{
|
'root':{
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import json
|
import json
|
||||||
from pytchat.parser.live import Parser
|
from pytchat.parser.live import Parser
|
||||||
from pytchat.processors.superchat.calculator import Calculator
|
from pytchat.processors.superchat.calculator import SuperchatCalculator
|
||||||
from pytchat.exceptions import ChatParseException
|
from pytchat.exceptions import ChatParseException
|
||||||
parse = Calculator()._parse
|
parse = SuperchatCalculator()._parse
|
||||||
|
|
||||||
|
|
||||||
def _open_file(path):
|
def _open_file(path):
|
||||||
@@ -38,7 +38,7 @@ def test_process_0():
|
|||||||
'timeout':10,
|
'timeout':10,
|
||||||
'chatdata':load_chatdata(r"tests\testdata\calculator\superchat_0.json")
|
'chatdata':load_chatdata(r"tests\testdata\calculator\superchat_0.json")
|
||||||
}
|
}
|
||||||
assert Calculator().process([chat_component])=={'¥': 6800.0, '€': 2.0}
|
assert SuperchatCalculator().process([chat_component])=={'¥': 6800.0, '€': 2.0}
|
||||||
|
|
||||||
def test_process_1():
|
def test_process_1():
|
||||||
"""
|
"""
|
||||||
@@ -49,7 +49,7 @@ def test_process_1():
|
|||||||
'timeout':10,
|
'timeout':10,
|
||||||
'chatdata':load_chatdata(r"tests\testdata\calculator\text_only.json")
|
'chatdata':load_chatdata(r"tests\testdata\calculator\text_only.json")
|
||||||
}
|
}
|
||||||
assert Calculator().process([chat_component])=={}
|
assert SuperchatCalculator().process([chat_component])=={}
|
||||||
|
|
||||||
def test_process_2():
|
def test_process_2():
|
||||||
"""
|
"""
|
||||||
@@ -62,7 +62,7 @@ def test_process_2():
|
|||||||
'chatdata':load_chatdata(r"tests\testdata\calculator\replay_end.json")
|
'chatdata':load_chatdata(r"tests\testdata\calculator\replay_end.json")
|
||||||
}
|
}
|
||||||
assert False
|
assert False
|
||||||
Calculator().process([chat_component])
|
SuperchatCalculator().process([chat_component])
|
||||||
except ChatParseException:
|
except ChatParseException:
|
||||||
assert True
|
assert True
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user