def test_write_no_codepage(self, driver): encode = MagicEncode( driver, defaultsymbol="_", encoder=Encoder({'CP437': 1}), encoding='CP437') encode.write(u'€ ist teuro.') assert driver.output == b'_ ist teuro.'
def test_get_encoding(self): Encoder({}).get_encoding_name('latin1')
def test_find_suitable_encoding(self): assert not Encoder({'CP437': 1}).find_suitable_encoding(u'€') assert Encoder({'CP858': 1}).find_suitable_encoding(u'€') == 'CP858'
def test_can_encode(self): assert not Encoder({'CP437': 1}).can_encode('CP437', u'€') assert Encoder({'CP437': 1}).can_encode('CP437', u'á') assert not Encoder({'foobar': 1}).can_encode('foobar', 'a')
def test_find_suitable_encoding(self): assert not Encoder({"CP437": 1}).find_suitable_encoding(u"€") assert Encoder({"CP858": 1}).find_suitable_encoding(u"€") == "CP858"
def test_can_encode(self): assert not Encoder({"CP437": 1}).can_encode("CP437", u"€") assert Encoder({"CP437": 1}).can_encode("CP437", u"á") assert not Encoder({"foobar": 1}).can_encode("foobar", "a")