Exemplo n.º 1
0
 def print_bill(self):
     gst_obj = GST(unit_price=self.product.unit_price,
                   category=self.product.category)
     gst_obj.print_gst()
     amount = TotalAmount(gst=gst_obj.gst_value,
                          quantity=self.product.quantity,
                          unit_price=self.product.unit_price)
     amount.print_amount()
Exemplo n.º 2
0
    def test_implicit_end(self):
        text = "c_aa"
        gst_obj = GST()
        for index, t in enumerate(text.split('_')):
            gst_obj.add_text(t, index)
        gst_obj.traverse(text)

        self.assertEqual(list(gst_obj.search('c')), [0])
        self.assertEqual(list(gst_obj.search('ca')), [])
        self.assertEqual(list(gst_obj.search('aa')), [1])
        self.assertEqual(list(gst_obj.search('d')), [])
Exemplo n.º 3
0
    def test_two_text(self):
        text = "abc_ccc"
        gst_obj = GST()
        for index, t in enumerate(text.split('_')):
            gst_obj.add_text(t, index)
        gst_obj.traverse(text)

        self.assertEqual(list(gst_obj.search('c')), [0, 1])
        self.assertEqual(list(gst_obj.search('cc')), [1])
        self.assertEqual(list(gst_obj.search('bc')), [0])
        self.assertEqual(list(gst_obj.search('d')), [])
Exemplo n.º 4
0
    def test_explicit_end(self):
        text = "ababa"
        gst_obj = GST()
        gst_obj.add_text(text, 0)
        gst_obj.traverse(text)

        self.assertEqual(list(gst_obj.search('c')), [])
        self.assertEqual(list(gst_obj.search('aba')), [0])
Exemplo n.º 5
0
    def test_normal(self):
        text = 'abcabcd'
        gst_obj = GST()
        gst_obj.add_text(text, 0)
        gst_obj.traverse(text)

        self.assertEqual(list(gst_obj.search('c')), [0])
        self.assertEqual(list(gst_obj.search('abcd')), [0])
        self.assertEqual(list(gst_obj.search('abcc')), [])
    def test_implicit_end(self):
        text = "c_aa"
        gst_obj = GST()
        for index, t in enumerate(text.split('_')):
            gst_obj.add_text(t, index)
        gst_obj.traverse(text)

        self.assertEqual(list(gst_obj.search('c')), [0])
        self.assertEqual(list(gst_obj.search('ca')), [])
        self.assertEqual(list(gst_obj.search('aa')), [1])
        self.assertEqual(list(gst_obj.search('d')), [])
    def test_two_text(self):
        text = "abc_ccc"
        gst_obj = GST()
        for index, t in enumerate(text.split('_')):
            gst_obj.add_text(t, index)
        gst_obj.traverse(text)

        self.assertEqual(list(gst_obj.search('c')), [0, 1])
        self.assertEqual(list(gst_obj.search('cc')), [1])
        self.assertEqual(list(gst_obj.search('bc')), [0])
        self.assertEqual(list(gst_obj.search('d')), [])
    def test_explicit_end(self):
        text = "ababa"
        gst_obj = GST()
        gst_obj.add_text(text, 0)
        gst_obj.traverse(text)

        self.assertEqual(list(gst_obj.search('c')), [])
        self.assertEqual(list(gst_obj.search('aba')), [0])
    def test_normal(self):
        text = 'abcabcd'
        gst_obj = GST()
        gst_obj.add_text(text, 0)
        gst_obj.traverse(text)

        self.assertEqual(list(gst_obj.search('c')), [0])
        self.assertEqual(list(gst_obj.search('abcd')), [0])
        self.assertEqual(list(gst_obj.search('abcc')), [])
Exemplo n.º 10
0
 def __init__(self, hparams):
     super(Tacotron2, self).__init__()
     self.mask_padding = hparams.mask_padding
     self.fp16_run = hparams.fp16_run
     self.n_mel_channels = hparams.n_mel_channels
     self.n_frames_per_step = hparams.n_frames_per_step
     self.embedding = nn.Embedding(hparams.n_symbols,
                                   hparams.symbols_embedding_dim)
     std = sqrt(2.0 / (hparams.n_symbols + hparams.symbols_embedding_dim))
     val = sqrt(3.0) * std  # uniform bounds for std
     self.embedding.weight.data.uniform_(-val, val)
     self.encoder = Encoder(hparams)
     self.decoder = Decoder(hparams)
     self.postnet = Postnet(hparams)
     self.gst = GST(hparams)
     self.linear_expand = nn.Linear(256, hparams.encoder_embedding_dim)
Exemplo n.º 11
0
 def test_gst_food(self):
     UNIT_PRICE = 100
     CATEGORY = "food-grains"
     gst_obj = GST(UNIT_PRICE, CATEGORY)
     self.assertEqual(gst_obj.calculate_gst(), 0.0, "Should be 0")
Exemplo n.º 12
0
 def test_gst_electronics(self):
     UNIT_PRICE = 5000
     CATEGORY = "electronics"
     gst_obj = GST(UNIT_PRICE, CATEGORY)
     self.assertEqual(gst_obj.calculate_gst(), 900, "Should be 900")
Exemplo n.º 13
0
 def test_gst_cosmetics(self):
     UNIT_PRICE = 200
     CATEGORY = "cosmetics"
     gst_obj = GST(UNIT_PRICE, CATEGORY)
     self.assertEqual(gst_obj.calculate_gst(), 56, "Should be 256")
Exemplo n.º 14
0
 def test_gst_furniture(self):
     UNIT_PRICE = 20000
     CATEGORY = "furniture"
     gst_obj = GST(UNIT_PRICE, CATEGORY)
     self.assertEqual(gst_obj.calculate_gst(), 1000, "Should be 1000")