Пример #1
0
    def testCanTestBoolDirectlyWithoutReason(self):
        assert_that(True)

        with self.assertRaises(AssertionError) as e:
            assert_that(False)
            
        self.assertEqual('Assertion failed', str(e.exception))
Пример #2
0
def test_element():
    ElementTest = xmlfied('element_test', ab=Element())

    a = ElementTest(ab='foo')
    assert_that(get_xml_string(a.toxml()), string_contains_in_order('<element_test>',
                                                                    '<ab>foo</ab>',
                                                                    '</element_test>'))
Пример #3
0
    def test_stop_game_with_nogame_status(self):
        when(self.server_proxy_spy.move).then_return(("NoGame", 0))

        self.robot.start(max_moves=10)

        assert_that(self.robot.status, equal_to("NoGame"))
        assert_that(self.robot.total_moves, equal_to(1))
Пример #4
0
    def test_win_in_a_move(self):
        when(self.server_proxy_spy.move).then_return(("YouWin", 10))

        self.robot.start(max_moves=2)

        assert_that(self.robot.status, equal_to("YouWin"))
        assert_that(self.robot.total_moves, equal_to(1))
Пример #5
0
    def test_game_over_in_a_move(self):
        when(self.server_proxy_spy.move).then_return(("GameOver", 0))

        self.robot.start(max_moves=10)

        assert_that(self.robot.status, equal_to("GameOver"))
        assert_that(self.robot.total_moves, equal_to(1))
Пример #6
0
    def test_dont_move_to_bad_cell_score(self):
        self.next_cell_calculator.cell_scores = {2: 8, 3: 10}
        self.next_cell_calculator.seek = 1
        self.next_cell_calculator.min_cell_score_to_move = 12
        self.next_cell_calculator.last_cell = Cell(1, 5)

        assert_that(self.next_cell_calculator.next(), equal_to(4))
Пример #7
0
    def test_move_to_high_cell_score(self):

        self.next_cell_calculator.cell_scores = {1: 10, 2: 50, 3: 5}
        self.next_cell_calculator.seek = 3
        self.next_cell_calculator.last_cell = Cell(3, 5)

        assert_that(self.next_cell_calculator.next(), equal_to(2))
Пример #8
0
    def test_unitValue(self):
        for unit in self.multiResult.units:
            result = self.multiResult.unitValue(unit)

            if unit is unit1:
                assert_that(result, equal_to(self.unit1Value * self.numTimes))
            elif unit is unit2:
                assert_that(result, equal_to(self.unit2Value * self.numTimes))
Пример #9
0
    def testCanTestBoolDirectly(self):
        assert_that(True, 'should accept True')

        try:
            assert_that(False, 'FAILURE REASON')
        except AssertionError, e:
            self.assertEqual('FAILURE REASON', str(e))
            return
Пример #10
0
    def testCanTestBoolDirectlyWithoutReason(self):
        assert_that(True)

        try:
            assert_that(False)
        except AssertionError, e:
            self.assertEqual('Assertion failed', str(e))
            return
Пример #11
0
    def test_no_more_than_one_move_at_a_minimum(self):
        self.server_proxy.move("robocop", 10)
        time1 = datetime.now()
        self.server_proxy.move("robocop", 12)
        time2 = datetime.now()

        assert_that(
            (time2 - time1).microseconds,
            greater_than_or_equal_to(200))
Пример #12
0
    def testWarnsForMatcherAsArg1(self):
        assert_that(True)

        with warnings.catch_warnings(record=True) as w:
            warnings.simplefilter("always")
            assert_that(equal_to(1))

            self.assertEqual(len(w), 1)
            self.assertTrue("arg1 should be boolean" in str(w[-1].message))
Пример #13
0
    def testAssertionErrorShouldDescribeExpectedAndActual(self):
        expected = 'EXPECTED'
        actual = 'ACTUAL'

        expectedMessage = "\nExpected: 'EXPECTED'\n     but: was 'ACTUAL'\n"

        with self.assertRaises(AssertionError) as e:
            assert_that(actual, equal_to(expected))

        self.assertEqual(expectedMessage, str(e.exception))
Пример #14
0
    def testAssertionErrorShouldIncludeOptionalReason(self):
        expected = 'EXPECTED'
        actual = 'ACTUAL'

        expectedMessage = "REASON\nExpected: 'EXPECTED'\n     but: was 'ACTUAL'\n"

        with self.assertRaises(AssertionError) as e:
            assert_that(actual, equal_to(expected), 'REASON')

        self.assertEqual(expectedMessage, str(e.exception))
Пример #15
0
def test_many_elements():
    Box = xmlfied('box', foos=Many(Element(name='foo')))

    box = Box(foos=['a', 'b', 'c'])

    assert_that(etree.tostring(box.toxml()), all_of(
                                                    string_contains_in_order('<box>', '<foos>', '<foo>', 'a', '</foo>', '</foos>', '</box>'),
                                                    string_contains_in_order('<box>', '<foos>', '<foo>', 'b', '</foo>', '</foos>', '</box>'),
                                                    string_contains_in_order('<box>', '<foos>', '<foo>', 'c', '</foo>', '</foos>', '</box>'),
                                                    ))
Пример #16
0
    def test_view_resource(self):
        url = 'dummy'
        user = DummyUser()

        http_request = MagicMock(user=user, method='GET')

        response = self.handler(http_request, url)

        assert_that(response.status_code, equal_to(200))
        assert_that(json.loads(response.content), equal_to({'name': 'dummy'}))
Пример #17
0
def test_query_system():
    """
    Performs a full system test, invoking a local instance of the H2 database.

    Set environment variable CI=true in continuous integration to skip.
    """
    if os.environ.get('CI'):
        return

    result = H2WorldServiceHandler().query('SELECT * FROM country')
    assert_that(len(result.splitlines()), equal_to(241))
Пример #18
0
    def testAssertionErrorShouldDescribeExpectedAndActual(self):
        expected = 'EXPECTED'
        actual = 'ACTUAL'

        expectedMessage = "\nExpected: 'EXPECTED'\n     but: was 'ACTUAL'\n"

        try:
            assert_that(actual, equal_to(expected))
        except AssertionError, e:
            self.assertEqual(expectedMessage, str(e))
            return
Пример #19
0
    def test_crud_resource_get_list(self):
        url = 'dummy'
        user = DummyUser()

        http_request = MagicMock(user=user, method='GET')

        response = self.handler(http_request, url)

        assert_that(response.status_code, equal_to(200))
        assert_that(json.loads(response.content), equal_to(
            {"objects": [{"name": "dummy"}], "meta": {"total": 1, "limit": 20, "offset": 0}}))
Пример #20
0
    def testAssertionErrorShouldIncludeOptionalReason(self):
        expected = 'EXPECTED'
        actual = 'ACTUAL'

        expectedMessage = "REASON\nExpected: 'EXPECTED'\n     but: was 'ACTUAL'\n"

        try:
            assert_that(actual, equal_to(expected), 'REASON')
        except AssertionError, e:
            self.assertEqual(expectedMessage, str(e))
            return
    def test_expected_has_the_wrong_type(self):
        # Given
        not_a_schema = "Test"

        # When
        with self.assertRaises(AssertionError) as ex:
            assert_that(self.df, has_schema(not_a_schema))

        # Then
        self.assertEqual(
            str(ex.exception.message),
            'Provided schema is not a StructType but <type \'str\'>'
        )
    def test_has_the_wrong_schema(self):
        # When
        with self.assertRaises(AssertionError) as ex:
            assert_that(self.df, has_schema(self.schema_1_field))

        # Then
        self.assertEqual(
            str(ex.exception.message),
            assertion_error_message(
                'Given DataFrame has schema %s' % self.schema_1_field,
                'has schema %s' % self.schema_2_fields
            )
        )
    def test_has_the_wrong_count(self):
        # Given
        wrong_count = 1

        # When
        with self.assertRaises(AssertionError) as ex:
            assert_that(self.df, has_count(wrong_count))

        # Then
        self.assertEqual(
            str(ex.exception.message),
            assertion_error_message('Given DataFrame has count 1', 'has count 2')
        )
    def test_expected_has_the_wrong_type(self):
        # Given
        not_a_field = "Test"

        # When
        with self.assertRaises(AssertionError) as ex:
            assert_that(self.df, has_schema_containing_field(not_a_field))

        # Then
        self.assertEqual(
            str(ex.exception.message),
            'Provided field is not a StructField but <type \'str\'>'
        )
Пример #25
0
    def test_intermediate_output_is_face_from_die(self):
        facevalue1 = FaceValue(1, unit1)
        facevalue2 = FaceValue(1, unit2)
        die = Die("Test",
                  Face(facevalue1, facevalue2),
                  Face(facevalue1, facevalue2))
        result = BaseRoller(die).roll()

        test_result = result.intermediateOutput

        assert_that(test_result, any_of(
            equal_to('[' + unit1(1) + ' | ' + unit2(1) + ']'),
            equal_to('[' + unit2(1) + ' | ' + unit1(1) + ']')))
Пример #26
0
    def test_final_output_works_with_multiple_face_values(self):
        facevalue1 = FaceValue(1, unit1)
        facevalue2 = FaceValue(1, unit2)
        die = Die("Test",
                  Face(facevalue1, facevalue2),
                  Face(facevalue1, facevalue2))
        result = BaseRoller(die).roll()

        test_result = result.finalOutput

        assert_that(test_result, any_of(
            equal_to(unit1(1) + ' | ' + unit2(1)),
            equal_to(unit2(1) + ' | ' + unit1(1))))
    def test_has_the_wrong_type(self):
        # Given
        not_a_dataframe = "Test"

        # When
        with self.assertRaises(AssertionError) as ex:
            assert_that(not_a_dataframe, has_count(2))

        # Then
        self.assertEqual(
            str(ex.exception.message),
            assertion_error_message('Given DataFrame has count 2', '<type \'str\'> is not a DataFrame')
        )
    def test_expected_has_the_wrong_type(self):
        # Given
        not_a_count = "Test"

        # When
        with self.assertRaises(AssertionError) as ex:
            assert_that(self.df, has_count(not_a_count))

        # Then
        self.assertEqual(
            str(ex.exception.message),
            'Provided count is not an int but <type \'str\'>'
        )
Пример #29
0
def test_cityLanguage_system():
    """
    Performs a full system test, invoking a local instance of the H2 database.

    Set environment variable CI=true in continuous integration to skip.
    """
    if os.environ.get('CI'):
        return

    result = H2WorldServiceHandler().cityLanguage('Melbourne')
    assert_that(result, equal_to('English (81.2%)'))

    result = H2WorldServiceHandler().cityLanguage('Kandy')
    assert_that(result, equal_to('Singali (60.3%)'))
Пример #30
0
def test_elements_order():
    Foo = xmlfied('foo', fields=[
                                  ('bar', Element()),
                                  ('baz', Element()),
                                  ('gaz', Element()),
                                  ('daz', Element())])

    foo = Foo(bar=3, baz=4, gaz=5, daz=6)

    assert_that(etree.tostring(foo.toxml()), string_contains_in_order(
                                                                      '<bar>', '3', '</bar>',
                                                                      '<baz>', '4', '</baz>',
                                                                      '<gaz>', '5', '</gaz>',
                                                                      '<daz>', '6', '</daz>'
                                                                      ))
Пример #31
0
def test_many_nested():
    Item = xmlfied('item', value=Element())
    Box = xmlfied('box', items=Many(Nested()))

    box = Box(items=[])
    box.items.append(Item('a'))
    box.items.append(Item('a'))
    box.items.append(Item('a'))

    assert_that(
        etree.tostring(box.toxml()),
        all_of(
            string_contains_in_order('<box>', '<items>', '<item>', 'a',
                                     '</item>', '<item>', 'a', '</item>',
                                     '<item>', 'a', '</item>', '</items>',
                                     '</box>'), ))
Пример #32
0
def test_nested():
    Top = xmlfied('top', foo=Nested())
    Down = xmlfied('down', bar=Element(), baz=Attribute())

    d = Down(bar='123', baz='456')
    t = Top(foo=d)

    assert_that(get_xml_string(t.toxml()), string_contains_in_order(
        '<top>',
        '<down',
        'baz=', '"456"',
        '<bar>',
        '123',
        '</bar>',
        '</down>',
        '</top>'
    ))
Пример #33
0
    def test_does_not_contain_the_field(self):
        # Given
        name = 'field2'
        data_type = StringType()
        not_in_dataframe_schema = StructField(name=name, dataType=data_type)

        # When
        with self.assertRaises(AssertionError) as ex:
            assert_that(self.df,
                        has_schema_containing_field(not_in_dataframe_schema))

        # Then
        self.assertEqual(
            str(ex.exception.message),
            assertion_error_message(
                'Given DataFrame\'s schema contains %s of type %s' %
                (name, data_type),
                'Schema only contains %s' % self.schema.names))
 def test_cash_amount_changed_make_change(self) -> None:
     """Cash amount changed must balance with change given."""
     drawer: CashDrawer = CashDrawer()
     total: float = drawer.get_total()
     drawer.open(187.91)
     cash_in: float = 200.0
     drawer.add_count(CashDenomination.HUNDRED_DOLLAR_BILL, 2)
     cash_in -= 0.01 * 4
     drawer.remove_count(CashDenomination.PENNY, 4)
     cash_in -= 0.05 * 1
     drawer.remove_count(CashDenomination.NICKEL, 1)
     cash_in -= 1.0 * 1
     drawer.remove_count(CashDenomination.DOLLAR_COIN, 1)
     cash_in -= 1.0 * 1
     drawer.remove_count(CashDenomination.ONE_DOLLAR_BILL, 1)
     cash_in -= 10.0 * 1
     drawer.remove_count(CashDenomination.TEN_DOLLAR_BILL, 1)
     assert_that(cash_in, close_to(187.91, 0.001))
     try:
         drawer.close()
         assert_that(drawer.get_total(), close_to(total + 187.91, 0.001))
     except Exception:
         pytest.fail("Unexpected Exception when closing drawer")
Пример #35
0
 def assert_that_output_contains(self, substring, times=None):
     assert_that(self.owtf_output, contains_string(substring))
     if times is not None:
         assert_that(self.owtf_output.count(substring), equal_to(times))
Пример #36
0
 def test_approved(self) -> None:
     """Test Approved."""
     assert_that(str(CardTransactionResult.APPROVED), is_("Approved"))
Пример #37
0
 def test_read_error(self) -> None:
     """Test Card Read Error."""
     assert_that(str(CardTransactionResult.READ_ERROR),
                 is_("Card Read Error"))
 def test_row_has_value(self):
     assert_that(Field('field1').of(self.row), has_value(42))
Пример #39
0
 def test_incorrect_pin(self) -> None:
     """Test Approved."""
     assert_that(str(CardTransactionResult.INCORRECT_PIN),
                 is_("Incorrect PIN"))
Пример #40
0
 def test_one_dollar_bill(self) -> None:
     """Test One Dollar Bill."""
     assert_that(str(CashDenomination.ONE_DOLLAR_BILL), is_("$1 Bill"))
     assert_that(CashDenomination.ONE_DOLLAR_BILL.amount,
                 close_to(1.0, 0.00001))
 def test_open_drawer_amount_negative(self) -> None:
     """Open drawer amount must not be negative."""
     drawer: CashDrawer = CashDrawer()
     with pytest.raises(ValueError) as e:
         drawer.open(-0.01)
     assert_that(str(e.value), is_("Amount must not be negative."))
Пример #42
0
 def test_enum_size(self) -> None:
     """Test size of enum."""
     assert_that(len(CashDenomination), is_(12))
Пример #43
0
 def test_hundred_dollar_bill(self) -> None:
     """Test Hundred Dollar Bill."""
     assert_that(str(CashDenomination.HUNDRED_DOLLAR_BILL),
                 is_("$100 Bill"))
     assert_that(CashDenomination.HUNDRED_DOLLAR_BILL.amount,
                 close_to(100.0, 0.00001))
Пример #44
0
 def test_fifty_dollar_bill(self) -> None:
     """Test Fifty Dollar Bill."""
     assert_that(str(CashDenomination.FIFTY_DOLLAR_BILL), is_("$50 Bill"))
     assert_that(CashDenomination.FIFTY_DOLLAR_BILL.amount,
                 close_to(50.0, 0.00001))
Пример #45
0
 def test_twenty_dollar_bill(self) -> None:
     """Test Twenty Dollar Bill."""
     assert_that(str(CashDenomination.TWENTY_DOLLAR_BILL), is_("$20 Bill"))
     assert_that(CashDenomination.TWENTY_DOLLAR_BILL.amount,
                 close_to(20.0, 0.00001))
Пример #46
0
 def test_ten_dollar_bill(self) -> None:
     """Test Ten Dollar Bill."""
     assert_that(str(CashDenomination.TEN_DOLLAR_BILL), is_("$10 Bill"))
     assert_that(CashDenomination.TEN_DOLLAR_BILL.amount,
                 close_to(10.0, 0.00001))
 def test_constructor_populates_drawer(self) -> None:
     """Test constructor."""
     drawer: CashDrawer = CashDrawer()
     for denom in CashDenomination:
         assert_that(drawer.get_count(denom), is_(10))
Пример #48
0
    def testCanTestBoolDirectly(self):
        assert_that(True, "should accept True")

        with self.assertRaises(AssertionError) as e:
            assert_that(False, "FAILURE REASON")
        self.assertEqual("FAILURE REASON", str(e.exception))
Пример #49
0
 def testShouldBeSilentOnSuccessfulMatch(self):
     assert_that(1, equal_to(1))
Пример #50
0
 def test_dollar_coin(self) -> None:
     """Test Dollar Coin."""
     assert_that(str(CashDenomination.DOLLAR_COIN), is_("Dollar Coin"))
     assert_that(CashDenomination.DOLLAR_COIN.amount,
                 close_to(1.0, 0.00001))
Пример #51
0
 def test_declined(self) -> None:
     """Test Declined."""
     assert_that(str(CardTransactionResult.DECLINED), is_("Declined"))
Пример #52
0
 def test_penny(self) -> None:
     """Test Penny."""
     assert_that(str(CashDenomination.PENNY), is_("Penny"))
     assert_that(CashDenomination.PENNY.amount, close_to(0.01, 0.00001))
Пример #53
0
 def test_insufficient_funds(self) -> None:
     """Test Approved."""
     assert_that(str(CardTransactionResult.INSUFFICIENT_FUNDS),
                 is_("Insufficient Funds"))
Пример #54
0
 def test_nickel(self) -> None:
     """Test Nickel."""
     assert_that(str(CashDenomination.NICKEL), is_("Nickel"))
     assert_that(CashDenomination.NICKEL.amount, close_to(0.05, 0.00001))
Пример #55
0
 def test_enum_size(self) -> None:
     """Test size of enum."""
     assert_that(len(CardTransactionResult), is_(5))
Пример #56
0
 def test_dime(self) -> None:
     """Test Dime."""
     assert_that(str(CashDenomination.DIME), is_("Dime"))
     assert_that(CashDenomination.DIME.amount, close_to(0.10, 0.00001))
Пример #57
0
    def testAssertionUnicodeEncodesProperly(self):
        expected = "EXPECTED"
        actual = u("\xdcnic\N{Latin Small Letter O with diaeresis}de")

        with self.assertRaises(AssertionError):
            assert_that(actual, equal_to(expected), "REASON")
Пример #58
0
 def test_quarter(self) -> None:
     """Test Quarter."""
     assert_that(str(CashDenomination.QUARTER), is_("Quarter"))
     assert_that(CashDenomination.QUARTER.amount, close_to(0.25, 0.00001))
Пример #59
0
    def test_should_create_sentence_binding_from_morpheme_containers(self):
        morpheme_containers = []
        morpheme_containers.append(self._get_word_morpheme_container_tuple(u'blablabla'))
        morpheme_containers.append(self._get_word_morpheme_container_tuple(u'Kitaba', u'kitap+Noun+A3sg+Pnon+Dat'))
        morpheme_containers.append(self._get_word_morpheme_container_tuple(u'abcabcabc'))
        morpheme_containers.append(self._get_word_morpheme_container_tuple(u'buyurmam'))
        morpheme_containers.append(self._get_word_morpheme_container_tuple(u'yetiştirdik'))
        morpheme_containers.append(self._get_word_morpheme_container_tuple(u'Kıvrandığın', u'kıvran+Verb+Pos+Adj+PastPart+P2sg'))
        morpheme_containers.append(self._get_word_morpheme_container_tuple(u'sabahçı'))
        morpheme_containers.append(self._get_word_morpheme_container_tuple(u'sabah'))
        morpheme_containers.append(self._get_word_morpheme_container_tuple(u"Ali'nin"))

        sentence = self.parseset_creator.create_sentence_binding_from_morpheme_containers(morpheme_containers)

        expected = u'''
<sentence>
	<unparsable_word str="blablabla"/>
	<word parse_result="kitap+Noun+A3sg+Pnon+Dat" str="Kitaba" syntactic_category="Noun">
		<root lemma="kitap" lemma_root="kitap" str="kitab" syntactic_category="Noun"/>
		<suffixes>
			<inflectionalSuffix actual="" application="" form="" id="A3Sg_Noun" matched_word="kitab" name="A3sg" to_syntactic_category="Noun" word="kitap"/>
			<inflectionalSuffix actual="" application="" form="" id="Pnon_Noun" matched_word="kitab" name="Pnon" to_syntactic_category="Noun" word="kitap"/>
			<inflectionalSuffix actual="a" application="a" form="+yA" id="Dat_Noun" matched_word="kitaba" name="Dat" to_syntactic_category="Noun" word="kitaba"/>
		</suffixes>
	</word>
	<unparsable_word str="abcabcabc"/>
	<word parse_result="buyur+Verb+Neg+Aor+A1sg" str="buyurmam" syntactic_category="Verb">
		<root lemma="buyurmak" lemma_root="buyur" str="buyur" syntactic_category="Verb"/>
		<suffixes>
			<inflectionalSuffix actual="ma" application="ma" form="mA" id="Neg" matched_word="buyurma" name="Neg" to_syntactic_category="Verb" word="buyurma"/>
			<inflectionalSuffix actual="" application="" form="" id="Aor" matched_word="buyurma" name="Aor" to_syntactic_category="Verb" word="buyurma"/>
			<inflectionalSuffix actual="m" application="m" form="+Im" id="A1Sg_Verb" matched_word="buyurmam" name="A1sg" to_syntactic_category="Verb" word="buyurmam"/>
		</suffixes>
	</word>
	<word parse_result="yetiş+Verb+Verb+Caus+Pos+Past+A1pl" str="yetiştirdik" syntactic_category="Verb">
		<root lemma="yetişmek" lemma_root="yetiş" str="yetiş" syntactic_category="Verb"/>
		<suffixes>
			<derivationalSuffix actual="tir" application="tir" form="dIr" id="Caus" matched_word="yetiştir" name="Caus" to_syntactic_category="Verb" word="yetiştir"/>
			<inflectionalSuffix actual="" application="" form="" id="Pos" matched_word="yetiştir" name="Pos" to_syntactic_category="Verb" word="yetiştir"/>
			<inflectionalSuffix actual="di" application="di" form="dI" id="Past" matched_word="yetiştirdi" name="Past" to_syntactic_category="Verb" word="yetiştirdi"/>
			<inflectionalSuffix actual="k" application="k" form="k" id="A1Pl_Verb" matched_word="yetiştirdik" name="A1pl" to_syntactic_category="Verb" word="yetiştirdik"/>
		</suffixes>
	</word>
	<word parse_result="kıvran+Verb+Pos+Adj+PastPart+P2sg" str="Kıvrandığın" syntactic_category="Adj">
		<root lemma="kıvranmak" lemma_root="kıvran" str="kıvran" syntactic_category="Verb"/>
		<suffixes>
			<inflectionalSuffix actual="" application="" form="" id="Pos" matched_word="kıvran" name="Pos" to_syntactic_category="Verb" word="kıvran"/>
			<derivationalSuffix actual="dığ" application="dık" form="dIk" id="PastPart_Adj" matched_word="kıvrandığ" name="PastPart" to_syntactic_category="Adj" word="kıvrandık"/>
			<inflectionalSuffix actual="ın" application="ın" form="+In" id="P2Sg_Adj" matched_word="kıvrandığın" name="P2sg" to_syntactic_category="Adj" word="kıvrandığın"/>
		</suffixes>
	</word>
	<word parse_result="sabah+Noun+Time+A3sg+Pnon+Nom+Adj+Agt" str="sabahçı" syntactic_category="Adj">
		<root lemma="sabah" lemma_root="sabah" secondary_syntactic_category="Time" str="sabah" syntactic_category="Noun"/>
		<suffixes>
			<inflectionalSuffix actual="" application="" form="" id="A3Sg_Noun" matched_word="sabah" name="A3sg" to_syntactic_category="Noun" word="sabah"/>
			<inflectionalSuffix actual="" application="" form="" id="Pnon_Noun" matched_word="sabah" name="Pnon" to_syntactic_category="Noun" word="sabah"/>
			<inflectionalSuffix actual="" application="" form="" id="Nom_Deriv_Noun" matched_word="sabah" name="Nom" to_syntactic_category="Noun" word="sabah"/>
			<derivationalSuffix actual="çı" application="çı" form="cI" id="Agt_Noun_to_Adj" matched_word="sabahçı" name="Agt" to_syntactic_category="Adj" word="sabahçı"/>
		</suffixes>
	</word>
	<word parse_result="sabah+Adv+Time" secondary_syntactic_category="Time" str="sabah" syntactic_category="Adv">
		<root lemma="sabah" lemma_root="sabah" secondary_syntactic_category="Time" str="sabah" syntactic_category="Adv"/>
	</word>
	<word parse_result="Ali+Noun+Prop+Apos+A3sg+Pnon+Gen" secondary_syntactic_category="Prop" str="Ali'nin" syntactic_category="Noun">
		<root lemma="Ali" lemma_root="Ali" secondary_syntactic_category="Prop" str="Ali" syntactic_category="Noun"/>
		<suffixes>
			<inflectionalSuffix actual="'" application="'" form="'" id="Apos_Proper_Noun" matched_word="Ali'" name="Apos" to_syntactic_category="Noun" word="Ali'"/>
			<inflectionalSuffix actual="" application="" form="" id="A3Sg_Noun" matched_word="Ali'" name="A3sg" to_syntactic_category="Noun" word="Ali'"/>
			<inflectionalSuffix actual="" application="" form="" id="Pnon_Noun" matched_word="Ali'" name="Pnon" to_syntactic_category="Noun" word="Ali'"/>
			<inflectionalSuffix actual="nin" application="nin" form="+nIn" id="Gen_Noun" matched_word="Ali'nin" name="Gen" to_syntactic_category="Noun" word="Ali'nin"/>
		</suffixes>
	</word>
</sentence>
'''
        expected = expected.strip()
        actual = sentence.to_dom().toprettyxml().strip()

        if expected!=actual:
            for line in context_diff(expected.split('\n'), actual.split('\n'), "expected", "actual"):
                print line

        assert_that(expected, equal_to(sentence.to_dom().toprettyxml().strip()))
Пример #60
0
 def test_half_dollar(self) -> None:
     """Test Half Dollar."""
     assert_that(str(CashDenomination.HALF_DOLLAR), is_("Half Dollar"))
     assert_that(CashDenomination.HALF_DOLLAR.amount,
                 close_to(0.50, 0.00001))