<commit_before># Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt

from __future__ import unicode_literals
import unittest
import frappe

from erpnext.stock.doctype.manage_variants.manage_variants import DuplicateAttribute

class TestManageVariants(unittest.TestCase):
	def test_variant_item_codes(self):
		manage_variant = frappe.new_doc("Manage Variants")
		manage_variant.update({
			"item": "_Test Variant Item",
			"attributes": [
				{
					"attribute": "Test Size",
					"attribute_value": "Small"
				},
				{
					"attribute": "Test Size",
					"attribute_value": "Large"
				}
			]
		})
		manage_variant.generate_combinations()
		self.assertEqual(manage_variant.variants[0].variant, "_Test Variant Item-S")
		self.assertEqual(manage_variant.variants[1].variant, "_Test Variant Item-L")
		
		self.assertEqual(manage_variant.variants[0].variant_attributes, "Small")
		self.assertEqual(manage_variant.variants[1].variant_attributes, "Large")

	def test_attributes_are_unique(self):
		manage_variant = frappe.new_doc("Manage Variants")
		manage_variant.update({
			"item": "_Test Variant Item",
			"attributes": [
				{
					"attribute": "Test Size",
					"attribute_value": "Small"
				},
				{
					"attribute": "Test Size",
					"attribute_value": "Small"<commit_msg>fixes in test cases<commit_after># Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt

from __future__ import unicode_literals
import unittest
import frappe

from erpnext.stock.doctype.manage_variants.manage_variants import DuplicateAttribute

class TestManageVariants(unittest.TestCase):
	def test_variant_item_codes(self):
		manage_variant = frappe.new_doc("Manage Variants")
		manage_variant.update({
			"item": "_Test Variant Item",
			"attributes": [
				{
					"attribute": "Test Size",
					"attribute_value": "Small"
				},
				{
					"attribute": "Test Size",
					"attribute_value": "Large"
				}
			]
		})
		manage_variant.generate_combinations()
		self.assertEqual(manage_variant.variants[0].variant, "_Test Variant Item-S")
		self.assertEqual(manage_variant.variants[1].variant, "_Test Variant Item-L")
		
		self.assertEqual(manage_variant.variants[0].variant_attributes, "Small")
		self.assertEqual(manage_variant.variants[1].variant_attributes, "Large")
		manage_variant.create_variants()

	def test_attributes_are_unique(self):
		manage_variant = frappe.new_doc("Manage Variants")
		manage_variant.update({
			"item": "_Test Variant Item",
			"attributes": [
				{
					"attribute": "Test Size",
					"attribute_value": "Small"
				},
				{
					"attribute": "Test Size",
					"attribute_value": "Small"
{'fraction_non_alphanumeric': 0.122040072859745, 'fraction_numerical': 0.006557377049180328, 'mean_word_length': 4.627049180327869, 'pattern_counts': {'":': 24, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3138323', 'n_tokens_mistral': 1050, 'n_tokens_neox': 861, 'n_words': 177}