コード例 #1
0
ファイル: test_populate.py プロジェクト: Julian/cardboard
    def test_load_cards(self):
        fbb = [u"Foo", u"Bar", u"Baz"]

        parse = mock.mocksignature(p.parse)

        for l, f in itertools.izip_longest(p.load_cards(S, _parse=parse), fbb):
            self.assertEqual(list(parse.mock.call_args[0][0]), [f] * 3)
コード例 #2
0
ファイル: test_populate.py プロジェクト: lkstrikez/cardboard
    def test_load_cards(self):
        fbb = [u"Foo", u"Bar", u"Baz"]

        parse = mock.mocksignature(p.parse)

        for l, f in itertools.izip_longest(p.load_cards(S, _parse=parse), fbb):
            self.assertEqual(list(parse.mock.call_args[0][0]), [f] * 3)
コード例 #3
0
ファイル: test_populate.py プロジェクト: Julian/cardboard
    def test_load_cards_default_file(self):
        codecs_open = u"cardboard.db.populate.codecs.open"

        with mock.patch(codecs_open, create=True) as m:
            m.return_value = mock.MagicMock(spec=file)
            cards = list(p.load_cards(_parse=mock.Mock()))

        m.assert_called_once_with(p.DEFAULT_CARDS_FILE, encoding="utf-8")
        self.assertTrue(m.return_value.close.called)
コード例 #4
0
ファイル: test_populate.py プロジェクト: lkstrikez/cardboard
    def test_load_cards_default_file(self):
        codecs_open = u"cardboard.db.populate.codecs.open"

        with mock.patch(codecs_open, create=True) as m:
            m.return_value = mock.MagicMock(spec=file)
            cards = list(p.load_cards(_parse=mock.Mock()))

        m.assert_called_once_with(p.DEFAULT_CARDS_FILE, encoding="utf-8")
        self.assertTrue(m.return_value.close.called)
コード例 #5
0
ファイル: test_populate.py プロジェクト: lkstrikez/cardboard
    def test_load_cards(self):
        parsed = p.load_cards(SAMPLE)

        self.assertEqual(
            next(parsed), {
                u"name":
                u"AErathi Berserker",
                u"mana_cost":
                u"2RRR",
                u"types": {u"Creature"},
                u"subtypes": {u"Human", u"Berserker"},
                u"supertypes":
                set(),
                u"power":
                u"2",
                u"toughness":
                u"4",
                u"loyalty":
                None,
                u"abilities": [
                    u"Rampage 3 (Whenever this creature becomes blocked, it "
                    u"gets +3/+3 until end of turn for each creature blocking "
                    u"it beyond the first.)"
                ],
                u"appearances": {(u"LE", u"U")},
            })

        self.assertEqual(
            next(parsed), {
                u"name":
                u"AEther Adept",
                u"mana_cost":
                u"1UU",
                u"types": {u"Creature"},
                u"subtypes": {u"Human", u"Wizard"},
                u"supertypes":
                set(),
                u"power":
                u"2",
                u"toughness":
                u"2",
                u"loyalty":
                None,
                u"abilities": [
                    u"When AEther Adept enters the battlefield, return target "
                    u"creature to its owner's hand."
                ],
                u"appearances": {(u"M11", u"C"), (u"M12", u"C")},
            })
コード例 #6
0
ファイル: test_populate.py プロジェクト: Julian/cardboard
    def test_load_cards(self):
        parsed = p.load_cards(SAMPLE)

        self.assertEqual(
            next(parsed),
            {
                u"name": u"AErathi Berserker",
                u"mana_cost": u"2RRR",
                u"types": {u"Creature"},
                u"subtypes": {u"Human", u"Berserker"},
                u"supertypes": set(),
                u"power": u"2",
                u"toughness": u"4",
                u"loyalty": None,
                u"abilities": [
                    u"Rampage 3 (Whenever this creature becomes blocked, it "
                    u"gets +3/+3 until end of turn for each creature blocking "
                    u"it beyond the first.)"
                ],
                u"appearances": {(u"LE", u"U")},
            },
        )

        self.assertEqual(
            next(parsed),
            {
                u"name": u"AEther Adept",
                u"mana_cost": u"1UU",
                u"types": {u"Creature"},
                u"subtypes": {u"Human", u"Wizard"},
                u"supertypes": set(),
                u"power": u"2",
                u"toughness": u"2",
                u"loyalty": None,
                u"abilities": [
                    u"When AEther Adept enters the battlefield, return target " u"creature to its owner's hand."
                ],
                u"appearances": {(u"M11", u"C"), (u"M12", u"C")},
            },
        )